ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeffrey E Care <>
Subject Re: Real meaning of javac target/source attributes
Date Thu, 16 Feb 2006 20:39:40 GMT
Your assumptions are incorrect; @target & @source have to do with language 
features and class file formats, not APIs.

The only 100% safe way I know of to make sure you aren't using improper 
APIs is to make sure you are compiling against the class library from the 
*lowest common denominator* JDK version you need to support. There are 
other ways to accomplish this (and Ant itself makes use of some of those 
techniques) but you can't rely on those being 100% safe.

Jeffrey E. (Jeff) Care (
IBM WebSphere Application Server Development

Matthew Hughes <> wrote on 02/16/2006 03:30:50 PM:

> It was my understanding that the target/source attributes in the javac 
> task forced the compiled classes to be compatible with old versions. 
> What I also assumed was that it wouldn't let me compile something if I 
> was using an API that was newer than the 'target' attribute.  For 
> example, my <javac> task compiles code that contains the 
> java.lang.Boolean.parseBoolean(String s) method just fine -- even though 

> that method was introduced in Java 1.5 and I have my target and source 
> set to 1.2. 
> Is there any task or utility out there that will actually check to see 
> if I am using an incompatible API -- without me having to download and 
> install really old JDKs and compile with them?
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message