ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chavdar Botev" <cbo...@gmail.com>
Subject a problem compiling a Java 5 project with generics
Date Tue, 17 Oct 2006 00:22:18 GMT
Hi!

I've come accross the following problem trying to compile Java 5
classes with generics using Ant 1.6.5. I've attached project
with sample Java classes and a build.xml file.

NOTE: Please create a src/test subdirectory and save the attached
.java files into it. The mailing list server gave me a hard time
acepting an email with the archived project files. :(

A clean build of the above project works just fine and compiles
without a problem. If after that, I touch the Test3.java file the
build fails with the following error:

 [javac] C:\src\appforge\test\src\test\Test3.java:5: incompatible types
 [javac] found   : test.Base
 [javac] required: test.Sub
 [javac] public Sub p() {return this.getV();}
 [javac] ^
 [javac] 1 error

Initially, I thought that this was a problem with the Java compiler.
After touching Test3.java, I tried running javac manually:

javac -sourcepath src -d bin -g -source 1.5 -target 1.5 src\test\*.java

It turned out that with the above command-line the project compiled
OK. The project also compiles without a problem in Eclipse 3.2.1.

Am I missing anything? It is my understanding that the build file and
the command line should produce the same results.

Upon further experimentation, if I uncomment the method in Test2.java
fixes the problem. Touching Test3.java does not break the build.

Thanks,
Chavdar

Mime
View raw message