ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fergus Gallagher <Fergus.Gallag...@OrbisUK.com>
Subject Re: JDK version checking
Date Mon, 10 Jul 2000 08:14:35 GMT
As a general rule you are right.  The first thing String.equals() does is 
the identity test so any performance loss is negligible.  After that it 
does a char by char comparison.

However, since Project.java assigns javaVersion to the fixed (static final) 
objects JAVA_1_x, there is no problem in this case.


At 22:33 08/07/00 +1000, you wrote:
>This is a minor curiosity.
>
>I noticed that a lot of code is checking the JDK version with code like
>         project.getJavaVersion() == Project.JAVA_1_1
>
>This is an identity test as opposed to an equality test. Since the objects
>involved are Strings, my instinctive reaction is to change these tests to
>.equals() but in this case an identity test is actually OK.
>
>Thoughts?
>
>Conor
>
>
>
>--
>Conor MacNeill
>Home: conor@m64.com
>Work: conor@cortexebusiness.com.au
>Web:  www.cortexebusiness.com.au

--
Fergus Gallagher
Orbis
http://www.orbisuk.com/
+44-(0)20-8987 0717


Mime
View raw message