[BUILD-426] Retire animal-sniffer on Java 9+ Created: 11/Dec/20  Updated: 13/Jun/22  Resolved: 22/Dec/20

Status: Closed
Project: Build
Component/s: Poms
Affects Version/s: None
Fix Version/s: POMs 41

Type: Improvement Priority: Neutral
Reporter: Mikaël Geljić Assignee: Mikaël Geljić
Resolution: Fixed Votes: 0
Labels: java11
Remaining Estimate: Not Specified
Time Spent: 26m
Original Estimate: Not Specified

Issue Links:
relation
is related to BUILD-751 Consider phasing out animal-sniffer m... Open
Template:
Acceptance criteria:
Empty
Date of First Response:
Epic Link: Build on JDK11+
Story Points: 1

 Description   

animal-sniffer is obsolete on Java 9 or higher, signatures don't exist, and java compiler release flag fulfills the same.

See also issue #62 at github

The javac tool has been extended with the release flag in Java 9, which does the signature checking like animal-sniffer. So there's no reason to create signatures for Java 9 and beyond.
See https://docs.oracle.com/en/java/javase/11/tools/javac.html#GUID-AEEC9F07-CB49-4E96-8BC7-BCC2C7F725C9__GUID-D343F6B4-3FDD-43A8-AD24-43DD70214471 and https://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#release

or

Starting with JDK9+ you can't define a full API signature cause based on the module system you can define your own (limited view on JDK). Apart from that you can use the release configuration in maven-compiler-plugin with JDK9+ to have exactly what animal sniffer offers and that's the reason why there are no JDK9+ signatures.



 Comments   
Comment by Mikaël Geljić [ 17/Dec/20 ]
  • Fixed: animal-sniffer failure because of non-existent signatures on modern JDKs.
  • Changed: Verify compatibility with older platform versions with javac --release argument (replacing animal-sniffer), see JEP 247.
  • preserve compatibility with javaVersion=1.8, parse it without the initial 1, as per JEP 223.
  • introduce integration tests, f**king finally!
Comment by Roman Kovařík [ 22/Dec/20 ]

The modules java versions in IDE are now being reset to ${javaVersionWithoutInitialOne}.

Comment by Mikaël Geljić [ 22/Dec/20 ]

Here I suppose IntelliJ is either not smart enough to infer from the compiler.release prop, and/or because it's concealed within a profile. Let's see if I can help it figure it out.

Also, my expectation would have been that, without being able to infer java version, IntelliJ would fall back to project version, not latest.

Generated at Sun Feb 11 23:41:48 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.