RFR: 8072379: Implement jdk.Version and jdk.OracleVersion

Daniel Fuchs daniel.fuchs at oracle.com
Wed Jan 13 09:01:13 UTC 2016

Hi Joe,

On 1/13/16 2:06 AM, Joseph D. Darcy wrote:
> Hi Iris,
> Catching up on old reviews, the regular expression for versions is given as
>      ^[1-9][0-9]*(((\.0)*\.[1-9][0-9]*)*)*$
> Is this equivalent to
>      ^[1-9][0-9]*(\.[0-9])*

Iris's regexp will disallow trailing .0

9.0.1 will match, but 9.0 and 9.0.0 will not - the version should
be plain 9 in those latter cases as documented in the javadoc.

I believe this is important because it ensures that the version string
is always in canonical form, which makes it possible to simply compare
the 'versions' list (List<Integer>) within the various variations
of equals...

So the regexp matching will eliminate non canonical forms without
having to perform further checks down the road.
Took me a while to figure it, I had to look at the test to
pinpoint it. Now that I understand, I find it quite elegant :-)

best regards,

-- daniel

More information about the core-libs-dev mailing list