ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: Building with JDK 1.3. Which version of ANT?
Date Thu, 30 Jul 2009 10:11:45 GMT
On 2009-07-30, Rez P <> wrote:

> I just got a successful build by using jdk 1.5, ant 1.7, and setting
> source & target attributes of the javac ant task to 1.3.  Do you see
> any problem with this configuration as far as jdk 1.5 adding
> unwanted stuff to my generated class files as opposed to, if I set
> my entire environment to jdk 1.3 and making sure that the old
> project doesn't become polluted with any new tools or libraries?

One thing is that you might use classes or methods present in Java 1.5
but not in 1.3 - this will compile on Java5 but fail if you try to run
the code on 1.3.  This may be possible to avoid if you are disciplined
enough 8-)

Unfortunately there are problems more subtle than that.  If Java5 (or
1.4) have introduced new method overloads the compiler may choose one
that doesn't exist in 1.3.

One example that I've encountered myself
StringBuffer.append(StringBuffer) which was added in Java 1.4.  say
you have

    StringBuffer sb1 = new StringBuffer();
    StringBuffer sb2 = new StringBuffer();

This will compile fine on both JDKs.  javac of JDK 1.3 (and earlier)
will use append(Object), any later javac will use append(StringBuffer).
Code compiled on Java 1.4 or later will throw an exception when run on
Java 1.3 or earlier.

These kinds of problems are way more difficult to catch when


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message