Version special case '9'

Lindenmaier, Goetz goetz.lindenmaier at
Tue Jan 26 16:13:23 UTC 2016


We appreciate the new version scheme introduced with JEP 223.
It simplifies the versioning and we agree that it is to it's best
downward compatible.

Unfortunately there is one exception to this.
The initial version of a new major release skips the minor and
security digits. This makes parsing the string unnecessarily
complicated, because the format is not predictable.

In this, the JEP also is inconsistent.
In chapter "Dropping the initial 1 element from version numbers"
it is argued that comparing "9.0.0" to "1.8.0" by digit will show that
9 is newer than 8. But there is no such version as 9.0.0.

This is stated in chapter "Version numbers": "The version number does
not include trailing zero elements; i.e., $SECURITY is omitted if it
has the value zero, and $MINOR is omitted if both $MINOR and $SECURITY
have the value zero."

Our BussinessObjects applications parse the option string
by Float.parseFloat(System.getProperty("java.version").substring(0,3))
This delivers 1.7 for Java 7, but currently crashes for jdk9, as it tries to
parse "9-i" from 9-internal.  With trailing .0.0, this would see 9.0 and
could parse the Java version until Java 99.

As a workaround for this, we are now configuring with --with-version-patch=1
which results in version string

At another place, we use split() to analyse the version.

if (Integer.parseInt(System.getProperty("java.version").split("\\.")[1]) > 7)) { ...

If there are always 3 numbers, this could be fixed to:

if (Integer.parseInt(System.getProperty("java.version").split("\\.")[0]) > 7) ||
    Integer.parseInt(System.getProperty("java.version").split("\\.")[1]) > 7)) { ...

which was probably in mind when the

But with omitting the .0.0, we must also split at '-' and '+':

String[] version_elements = System.getProperty("java.version").split("\\.|-|+");
if (Integer.parseInt(version_elements[0]) > 7) ||
    Integer.parseInt(version_elements[1]) > 7)) { ...

If you want to check for a version > 9.*.22 it's even more complicated:

String[] version_elements = System.getProperty("java.version").split("+|-")[0].split("\\.");
if (Integer.parseInt(version_elements[0]) > 9 ||
    (Integer.parseInt(version_elements[0]) == 9 &&
     version_elements.length >= 3 &&
     Integer.parseInt(version_elements[2]) >  22)) { ...

So we would appreciate if the JEP was enhanced to always guarantee three
version numbers 'x.y.z'.

Further, version number breaks the jck test api/java_lang/System/index.html#GetProperty.
It fails with: "getJavaSpecVersion0001: Failed. System property 'java.specification.version' does not corresponds to the format 'major.minor.micro'".
Maybe a fix of this test is already worked on, we are using jck suite from 9.9.15.

Best regards,

More information about the hotspot-dev mailing list