Gradle / subprojects / base-services / src / test / groovy / org / gradle / api
JavaVersionSpec.groovy
c1fe5e4Add test case for `10-internal`
500485dSupport running Gradle on JDK 10
This commit adds support for `JavaVersion.1_10` (yes, this is awkward naming, blame versioning scheme change). Note that there are 2 different aspects of Java 10 detection: 1. given a string representation of a version number, return the appropriate `JavaVersion` enum value 2. given the current runtime, return the appropriate `JavaVersion` enum value This commit fixes 1, but didn't change anything in the way 2 works. In particular, 2 still uses the `java.version` property, which is then parsed and we follow the process of 1. However, since Java 9, a new `Runtime#getVersion` method exists, that we should use instead of relying on parsing the version number returned by `java.version`. The reason we don't do this yet is that Gradle needs to run on older JDKs, so we cannot statically link to this method, which involves either the use of reflection or method handles to get a hand on the result of the invocation. Since the invocation returns a complex object (not just a `String`), we're deferring this work (PRs welcome!). |
![]() |