ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse Glick <Jesse.Gl...@netbeans.com>
Subject Re: [PATCH] Available.java - to detect JDK versions
Date Mon, 24 Jul 2000 16:34:21 GMT
Tim Fennell wrote:
> First off, you're right. I'm not sure what I was going, but that code is totally
> whacked! About using int arithmatic though...Are we guaranteed that each minor
> version number will contain no leading zeros? If we are, then I'll implement it
> with ints.  Otherwise I'll do as you suggest but parse each major/minor version
> number to a double so I can deal with leading zeros appropriately. Consider the
> (hypothetical) case:
>         1.4.1
>         1.4.02
> 
> 1.4.1 should come first, but 02 will parseInt to 2 and make 1.4.02 greater.

I think the Java Versioning Specification is supposed to be used for
these numbers...that would specify a lexicographic Dewey-decimal-style
comparison, each segment by itself, and would treat 1.4.02 the same as
1.4.2. But beware: I have seen beta JDKs stick extra nonsense in there
such as "1.2beta" which screws things up. I sent a bug report to the JDC
complaining that they ought not use non-Dewey-decimal version numbers,
but to no apparent avail.

Anyway, comparisons should apply only to java.specification.version, not
java.version which is not guaranteed to be anything in particular other
than descriptive. For example in my VM all is well:

java.version: 1.3.0beta_refresh
java.specification.version: 1.3

-Jesse

-- 
Jesse Glick   <mailto:Jesse.Glick@netbeans.com>
NetBeans, Open APIs  <http://www.netbeans.org/>
tel (+4202) 3300-9161 Sun Micro x49161 Praha CR

Mime
View raw message