Ordering of versions
Neil Bartlett
njbartlett at gmail.com
Wed Nov 9 08:59:21 PST 2011
Forgive me if I have missed something, but if a version
segment/qualifier can be interpreted as either a number or a string,
depending on whether it is compared against another number or string,
then versions are not totally ordered.
For example:
"1B" is greater than "10"
10 is greater than 2
"2" is greater than "1B"
Therefore "1B" is greater than "1B".
Neil
On Wed, Nov 9, 2011 at 4:37 PM, <mark.reinhold at oracle.com> wrote:
> 2011/11/9 7:47 -0800, gnormington at vmware.com:
>> I see. How are the tokens of a qualifier compared? If they are compared
>> just like the initial part,
>
> Yes.
>
>> then that would be a numeric comparison for
>> numeric tokens, but what about non-numeric tokens like BETA and GA?
>
> They are compared lexicographically, so BETA < GA.
>
>> Are
>> tokens compared as strings if at least one of the tokens being compared
>> is non-numeric?
>
> Yes.
>
>> Or I can read the code if you prefer to send me a link. ;-)
>
> http://hg.openjdk.java.net/jigsaw/jigsaw/jdk/file/960eb03d1270/src/share/classes/org/openjdk/jigsaw/JigsawVersion.java
>
> - Mark
>
More information about the jigsaw-dev
mailing list