RFR: 8160954: (spec) Runtime.Version regex and $PRE/$OPT issues

Paul Sandoz paul.sandoz at oracle.com
Mon Oct 24 18:37:14 UTC 2016


> On 20 Oct 2016, at 20:34, Iris Clark <iris.clark at oracle.com> wrote:
> 
> Hi.
> 
> Please review changes to address the following closely related bugs:
> 
>    8160954: (spec) Runtime.Version regex and $PRE/$OPT issues
>    https://bugs.openjdk.java.net/browse/JDK-8160954
> 
>    8148822: (spec) Regex in Runtime.Version and JEP 223 should match
>    https://bugs.openjdk.java.net/browse/JDK-8148822
> 
>    8148877: (spec) Specify when and empty '+' is required in a version
>        string
>    https://bugs.openjdk.java.net/browse/JDK-8148877
> 
> webrev:
> 
>    http://cr.openjdk.java.net/~iris/verona/8160954/webrev/
> 
> Changes to the specification of the $VNUM and $OPT regexp:
> 
> For line 963, we remove the leading '^' and trailing '$'.  These characters
> are not strictly required for the regex to be accurate.  They're not included
> in the implementation.  The presence of the trailing '$' precludes direct
> substitution of this regex into the definition of $VSTR at line 1032 (see
> bug 8160954).
> 
> Also for line 963, we remove the outermost qualifier in the portion of the
> regex describing elements after $MAJOR.  This qualifier is redundant and a
> source of catastrophic backtracking as described in this message [0, item 1]
> (see bug 8148822).  It's not in the present implementation.
> 
> For line 1050, we remove the '\' as it is unnecessary in a character class
> [0, item 4] (see bug 8148822).
> 
> 
> Changes to the spec for $PRE/$OPT:
> 
> For lines 1056-1057, we clearly specify when an empty '+' is required (see
> bugs 8148877, 8160954).  This spec corresponds to the code for additional
> constraints for the "empty '+'" beginning at new line 1150.
> 

Looks good except for:

-     * <p> A version number {@code 10-ea} matches {@code $VNUM = "10"} and
+     * <p> If the build number is unset, then {@code '+'} may only be present
+     * when {@code $OPT} is present and {@code $PRE} is not.
+     * A version number {@code 10-ea} matches {@code $VNUM = "10"} and
      * {@code $PRE = "ea"}.  The version number {@code 10+-ea} matches
      * {@code $VNUM = "10"} and {@code $OPT = "ea"}. </p>


“unset” or “not present”?

It might be better to place that new text at the end as it dives right in at the deep end. Perhaps say at the end:

  More specifically, if the build number is not present, then...

Paul.


> 
> The required CCC is in progress.
> 
> Thanks,
> iris
> 
> [0] http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-January/038036.html
> [1] http://download.java.net/java/jdk9/docs/api/java/lang/Runtime.Version.html



More information about the core-libs-dev mailing list