On Sat, 23 Nov 2024 09:22:36 GMT, Nir Lisker <nlis...@openjdk.org> wrote:
> Replaces the manual versions handling with > [Version](https://docs.oracle.com/en/java/javase/23/docs/api/java.base/java/lang/Runtime.Version.html). > > Changes: > * Removed the methods `parseJavaVersion(String)`, `parseJdkVersion(String)` > and `compareJdkVersion(String, String)`, and replaced them with > `Version.parse` and `Version.compareTo` methods. > * Removed the build properties of the Java version on which the Gradle build > runs because they are only used for logging. Replaced with logging them > directly. Note that Gradle logs by itself the info of the runtime it uses, so > there's no need to logs these manually. > * Simplified the build JDK version by working directly with `Version` instead > of a `String`. This allows to store less build properties. Also used > try-with-resources to close the stream. Note that the whole build JDK manual > invocation hack should be replaced with the Java Toolchain. > * Simplified the `verifyJava` task, which could also be replaced with > built-in Gradle tools. All of my testing looks fine, including CI and local testing. There is one error case where we will now fail with a less informative error message than we used to, but it is a corner case where JDK 8 is used (which hasn't worked for over 7 years), so I don't see it as a problem. In current master, running with JDK 8 will fail with the following error: * What went wrong: Execution failed for task ':verifyJava'. > FAIL: java version mismatch: JDK version (1.8.0_371) < minimum version (22) With this patch, building with JDK 8 will fail with one of two different errors, depending on whether the JDK to run gradle is also JDK or is JDK 11 or higher: Using JDK 21 to run gradle and setting `JDK_HOME` to JDK 8: FAILURE: Build failed with an exception. * Where: Build file '/Users/kcr/dev/javafx/jfx-kcr/jfx/rt/build.gradle' line: 760 * What went wrong: A problem occurred evaluating root project 'rt'. > Invalid version string: '1.8.0_371-ea-85-b01' Using JDK 8 to run gradle and compile JavaFX: FAILURE: Build failed with an exception. * Where: Build file '/Users/kcr/dev/javafx/jfx-kcr/jfx/rt/build.gradle' line: 760 * What went wrong: A problem occurred evaluating root project 'rt'. > java/lang/Runtime$Version The latter won't be possible in gradle 9 anyway (the JDK used to run gradle 9 will need to be >= 11), so even less of a concern. ------------- Marked as reviewed by kcr (Lead). PR Review: https://git.openjdk.org/jfx/pull/1647#pullrequestreview-2459846971