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

joe darcy joe.darcy at oracle.com
Thu Jan 14 06:56:21 UTC 2016

Hi Daniel,

On 1/13/2016 1:01 AM, Daniel Fuchs wrote:
> 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 :-)

Ah okay, I missed those points when reading over the regular expression.

I suggest some discussion be added to explain and document that those 
aspects of the design are intentional.



More information about the core-libs-dev mailing list