On Fri, 2005-03-18 at 07:20, Mikael Petterson (KI/EAB) wrote:
> Hi,
> 
> I have set javac's  source attribute  to 1.3 but when I compile the code I 
> get,
> 
> ".. warning: as of release 1.4, assert is a keyword..."
> 

> I start ant with 1.4.2 so I guess that is the default for compiling code to.

http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javac.html

Default for compiling is 1.3 unless specified.

> As I understand it the javac command with option '-source 1.3' would make the 
> 1.4 compiler to compile for 1.3?! 

Correct - no 1.4 only features will work.

> 
> This is what I use in my build.xml
> 
> <javac  debug="true" deprecation="true" destdir="${classes.dir}" 
>          srcdir="${src.dir}" source="${BUILD.COMPILER}">
> 
> Any ideas why?
> 

I'm guessing that the warning is a polite way of letting you know that
your code might need some changes when ported to 1.4, for instance, if
you use your own assertion mechanism with a method named assert rather
than 1.4 assertions; e.g. using 1.4.2 SDK, 

public class HelloWorld {
        public static void main(String [] args) {
                assert(true);
                System.out.println("Boo");
        }
                                                                                
                                                                             
        private static void assert(boolean test) {
                System.out.println(test);
        }
}

will compile with two warning using `javac HelloWorld.java`, or equivalent 
javac task, but will fail with an error using `javac -source 1.4 
HelloWorld.java`.

HTH

James

> //Mikael
> 
> -----Original Message-----
> From: Ivan Ivanov [mailto:[EMAIL PROTECTED]
> Sent: den 17 mars 2005 15:31
> To: Ant Users List
> Subject: RE: set jvm to 1.3
> 
> 
> AFAIK, target means to what version of class format
> must the compiled classes conform to; compiler means
> what compiler exactly should be used for compilation
> (i.e. to produce these classes).
> 
> HTH Ivan
> 
> --- "Mikael Petterson (KI/EAB)"
> <[EMAIL PROTECTED]> wrote:
> > Hi again,
> > 
> > So what is the difference of
> > 
> > javac attributes "target" and "compiler".
> > If I want to make sure that my code is compilable
> > for 1.3?
> > I am getting somewhat confused.
> > 
> > //Mikael
> > -----Original Message-----
> > From: Ivan Ivanov
> > [mailto:[EMAIL PROTECTED]
> > Sent: den 17 mars 2005 14:53
> > To: Ant Users List
> > Subject: RE: set jvm to 1.3
> > 
> > 
> > 
> > --- "Mikael Petterson (KI/EAB)"
> > <[EMAIL PROTECTED]> wrote:
> > > Thanks for the hint!
> > > 
> > > In ant there is a property called:
> > > 
> > > ant.java.version
> > It is the java version ant is started with.
> > 
> > > 
> > > What does that tell us? Does it say anything about
> > > the version of compiler used?
> > I suppose it does not say, because you can start Ant
> > with one jvm, but compile your sources with another
> > java compiler, say jikes, gcj, etc.
> > 
> > HTH Ivan
> > 
> > > Or is it the jvm that ant was started with?
> > > 
> > > //Mikael
> > > 
> > > -----Original Message-----
> > > From: Ivan Ivanov
> > > [mailto:[EMAIL PROTECTED]
> > > Sent: den 17 mars 2005 13:49
> > > To: Ant Users List
> > > Subject: Re: set jvm to 1.3
> > > 
> > > 
> > > See target attribute of <javac> task. You can do
> > it
> > > like this:
> > > 
> > > <javac target="${javac.target}" ...>,
> > > define javac.target properties in your
> > > build.properties as
> > > javac.target=1.3
> > > 
> > > HTH Ivan
> > > 
> > > 
> > > --- "Mikael Petterson (KI/EAB)"
> > > <[EMAIL PROTECTED]> wrote:
> > > > Hi,
> > > > 
> > > > I am starting ant 1.6.1 with jdk1.4.2 but I need
> > > to
> > > > compile my code with 1.3.
> > > > How can I set this in my build.properties and
> > then
> > > > use in my javac task?
> > > > 
> > > > Any hints?
> > > > 
> > > > //Mikael
> > > > 
> > > >
> > >
> >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > > [EMAIL PROTECTED]
> > > > For additional commands, e-mail:
> > > > [EMAIL PROTECTED]
> > > > 
> > > > 
> > > 
> > > 
> > >           
> > > __________________________________ 
> > > Do you Yahoo!? 
> > > Yahoo! Small Business - Try our new resources
> > site!
> > > http://smallbusiness.yahoo.com/resources/
> > > 
> > >
> >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > [EMAIL PROTECTED]
> > > For additional commands, e-mail:
> > > [EMAIL PROTECTED]
> > > 
> > > 
> > >
> >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > [EMAIL PROTECTED]
> > > For additional commands, e-mail:
> > > [EMAIL PROTECTED]
> > > 
> > > 
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam
> > protection around 
> > http://mail.yahoo.com
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> > 
> > 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to