Conversation
Add the class version to JavaClass so rules can verify the class version
|
I followed the guidelines in the original issue, but was unsure about testing. How would you advise testing this? |
|
One option could be to commit compiled classes in |
|
Do you have an example test method/class I should follow the style/pattern of? |
| * @return The Java version | ||
| */ | ||
| public int getJavaVersion() { | ||
| return major - 44; |
There was a problem hiding this comment.
to be a bit nitpicky:
Do you consider the version old java versions 1.0, 1.1, ... as 1, 1, 2?
https://javaalmanac.io/bytecode/versions/
Java 1.0 -> class file version 45.0 -> java version 1
Java 1.1 -> class file version 45.3 -> java version 1
Java 1.2 -> class file version 46.0 -> java version 2
...
starting from Java5 you calculation works perfectly fine, before that the numbering is already weird on java side.
Do we ignore this since these version are so ancient that we can't expect anyone to stumble over java classes compiled before java 5?
Since even Java 8 is currently dyng, this should be fine
|
A test would be really great for this, including the LTS versions starting from Java 8: 8, 11, 17, 21, 25 |
Add the class version to JavaClass so rules can verify the class version
Fixes #423