Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downgrade accidental use of Java 1.7 APIs [SPR-11319] #15943

Closed
spring-projects-issues opened this issue Jan 16, 2014 · 4 comments
Closed

Downgrade accidental use of Java 1.7 APIs [SPR-11319] #15943

spring-projects-issues opened this issue Jan 16, 2014 · 4 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Jan 16, 2014

Stéphane Nicoll opened SPR-11319 and commented

To prevent issue similar to #15937 we have integrated animal sniffer in our build to check the use of the JDK APIs.

This issue is about collecting the classes that are using 1.7+ APIs, knowing that some are for perfectly valid reasons (support of 1.8 features)


Issue Links:

Referenced from: commits 838855b

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Jan 16, 2014

Stéphane Nicoll commented

StandardTypeComparator (due to #13802)

@spring-projects-issues
Copy link
Collaborator Author

Stéphane Nicoll commented

snicoll@6d1c215 fixes the only accidental use of the Java 1.7 APIs.

Juergen can you please review and cherry pick it? Thanks!

@spring-projects-issues
Copy link
Collaborator Author

Stéphane Nicoll commented

Juergen, as you're working on that, I'll assign it to you.

Thanks

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Fixed along with a general revision of StandardTypeComparator.

As a reminder for casual readers: For some reason, Integer.compare and Long.compare have been introduced as late as JDK 1.7, even if their Float and Double counterparts have been available for much longer.

Since all that those compare methods do is to calculate a comparison result based on primitive values, it's straightforward to implement equivalent behavior:

private static int compare(int x, int y) {
return (x < y ? -1 : (x > y ? 1 : 0));
}

private static int compare(long x, long y) {
return (x < y ? -1 : (x > y ? 1 : 0));
}

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants