jenkins
jenkins copied to clipboard
Simplify Util-methods for checking JVM version
Given the fact that JVM versions were prefixed with '1.' until Java 9, there are 2 helper methods regarding the Java version being used; 'Java 8 or older' and 'Java 9 or newer'.
Since the methods are mutually exclusive and are essentially an inverse of one another, the issue was that both methods get the runtime Java version and then check if the version begins with '1.'. But because of the inverse property, only one method needs to do this check, and the other call the first and invert the result.
Yay, your first pull request towards Jenkins core was created successfully! Thank you so much!
A contributor will provide feedback soon. Meanwhile, you can join the chats and community forums to connect with other Jenkins users, developers, and maintainers.
Considering that Jenkins is built with java11 you could simply return true
for isRunningWithPostJava8 and false
for isRunningWithJava8OrBelow
That said these methods seems to be obsolete somehow maybe they should be deprecated together with the JavaVersionRecommendationAdminMonitor for now. At a later point in time it might make sense to reactivate this when Jenkins wants to recommend using java 17 maybe.
That said these methods seems to be obsolete somehow maybe they should be deprecated
That'd make sense, although that'd be something for a different PR, to cleanup the Java 8 warning stuff.
Hey @Chrimle,
do you think you can apply the simplification recommended?
Hi @NotMyFault & @mawinter69 !
Sure thing, I could to the suggested changes. Should I at the same time also mark these as deprecated?
Is there a specific 'since' version that should be referenced instead of a date?
Description of Deprecation;
@deprecated because the current version is at least Java 11, this method is redundant.
Is there a specific 'since' version that should be referenced instead of a date?
TODO
; automatic tooling will fill in the tag version it has been released in.
TODO
; automatic tooling will fill in the tag version it has been released in.
Oh, very cool! Will update this. Thanks!
Just FYI, you need to mark this PR as "Ready for review" over draft, to get reviews 👀