commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Colebourne <scolebou...@btopenworld.com>
Subject Re: [all] [digester] [VOTE] release version 1.7 - REPOST
Date Sun, 12 Jun 2005 13:46:24 GMT
> On Sat, 2005-06-11 at 19:50 -0400, Steven Caswell wrote:
>>Just one question about the jar:
>>
>>The manifest indicates the jar was built with JDK 1.5. Does this
>>present any issues with running against previous Java versions?
> 
Simon Kitching wrote:
>   maven.compile.target=1.2
>   maven.compile.source=1.2
> 
> So the .class files in the jar are useable in any 1.2 JVM, despite being
> compiled via JDK 1.5. I have tested this and the jar works fine with
> java 1.3.

IMHO, the compile target flag is useless, and this is a dangerous 
approach. It only provides bytecode compatibility, which isn't enough.

This is because when you compile on a later JDK, it still compiles 
against the Java class library of that later JDK. Many methods have been 
added to key classes since 1.2 that a 1.5 compiler will choose to bind 
to. When run on 1.2, the methods don't exist in the class library, so a 
NoSuchMethodError (not Exception) occurs.

(eg. append(StringBuffer) in StringBuffer)

The only safe approach is to compile on the JDK you intend to be 
compatible with. And, unless I've missed something, that usually can't 
be done with a maven build.

Stephen



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message