JDK-8158155 : (spec) Runtime.Version version string is ambiguous (JEP 223)
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 9
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • OS: generic
  • CPU: generic
  • Submitted: 2016-05-27
  • Updated: 2016-07-06
  • Resolved: 2016-07-06
Related Reports
Relates :  
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :


A DESCRIPTION OF THE PROBLEM :
According to JEP 223, the version format is:
$VNUM(-$PRE)?(\+$BUILD)?(-$OPT)?

Both PRE and OPT are alphanumeric, with OPT additionally allowing periods.

Since PRE, BUILD, and OPT are all optional, there is no way to distinguish a version identifier with no PRE or BUILD and an OPT that does not contain a period, and one with a PRE but no BUILD or OPT.

In other words, if the version identifier is "9-something", "something" could either be a pre release identifier or optional information. I don't see anything in the specification that distinguishes these two possibilities.


REPRODUCIBILITY :
This bug can be reproduced always.


Comments
JDK-8072379, fixed in jdk-9+105 (http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/7adef1c3afd5) modified the regular expression to eliminate the ambiguity. This change was retained through the re-location of the class in JDK-8144062 (jdk-9+120). During re-location the following clarifying example was added: A version number 10-ea matches $VNUM = "10" and $PRE = "ea". The version number 10+-ea matches $VNUM = "10" and $OPT = "ea". JEP 223 (http://openjdk.java.net/jeps/223) contains identical changes.
06-07-2016