db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <Knut.Hat...@Sun.COM>
Subject Re: Java 1.4.2 or Java6?
Date Thu, 25 Jun 2009 12:19:41 GMT
Tiago Espinha <tiago@espinhas.net> writes:

> Hello everyone,
>
> I have been around for a couple of months and I still manage to learn
> something new everyday; also, I manage to find something everyday about which
> I am not sure how I should address.
>
> This time I am wondering about the Java version. Basically I have two setups:
> on one of them I have *only* jdk 1.6 and on the other I have the whole set of
> jdks (1.4.2, 1.5 and 1.6).
>
> Yesterday, I made a change and it compiled normally against Sun's jdk1.6 -
> however, when I ported it over to the other setup to run suites.All, it
> wouldn't compile since it was attempting to use 1.4.2 (on this one I have all
> the jdks declared in the ant.properties file) and the change uses an overload
> that was only introduced in either 1.5 or 1.6.
>
> Since this is a change I made on a test, should I make sure it is backwards
> compatible with 1.4.2 or is 1.6 fine?

Unless there's a good reason why the test should not run on 1.4.2 or on
Java ME, I think it's best to make it backwards compatible. If it is
only supposed to run on newer JDKs, you'd also have to change the build
script so that it is always compiled against the correct class library
(otherwise the build will fail for those who have a setup with 1.4.2),
and there must also be logic in the test's suite() method or in the
_Suite class to prevent the test from running on older JDKs (otherwise
it'll fail in many of the nightly tests).

> Also, is there a way to force ant to use 1.6 when all the jdks are
> available?

If you only want to use it for some of the classes, locate the build.xml
file that contains the build target for those classes and add an
<exclude> tag that excludes the files in question. Then create a new
javac target (if it does not already exist) which includes the files and
where you change source/target/classpath as needed. To use 1.6,
classpath would need to contain ${java16compile.classpath}. See
java/engine/org/apache/derby/impl/services/build.xml for an example.

If you want to change it for the entire setup, so that the setup with
1.4.2, 1.5 and 1.6 behaves like the one with only 1.6, you'd need to set
java14compile.classpath and java15compile.classpath manually in
ant.properties. They need to include <jdk6home>/lib/jre/*.jar,
<derbysrc>/tools/java/xalan.jar and <derbysrc>/classes/stubs/jdbc3, I
think. But by doing this you risk introducing build breaks for others.

-- 
Knut Anders

Mime
View raw message