Summary: | a problem compiling a Java 5 project with generics | ||
---|---|---|---|
Product: | Ant | Reporter: | Chavdar Botev <cbotev> |
Component: | Core tasks | Assignee: | Ant Notifications List <notifications> |
Status: | RESOLVED FIXED | ||
Severity: | major | ||
Priority: | P2 | ||
Version: | 1.6.5 | ||
Target Milestone: | 1.7.1 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Attachments: | Sample project for reproducing the problem |
Description
Chavdar Botev
2006-10-17 09:31:10 UTC
Created attachment 19017 [details]
Sample project for reproducing the problem
There is also a thread about this issue on the user mailing list at http://marc.theaimsgroup.com/?l=ant-user&m=116110133201615&w=2 Upping the severity level. Ok, could also verify that with the given sample project. I changed the buildfile, so a single Ant run would produce the error: <project name="Test" default="build"> <presetdef name="compile"> <javac srcdir="src" destdir="bin" target="1.5" source="1.5" debug="true" listfiles="true"> </javac> </presetdef> <target name="build"> <mkdir dir="bin"/> <compile/> <delete><fileset dir="bin/test" includes="Test3*.class"/></delete> <compile/> </target> </project> Also tested with Ant 1.7.0beta2 (September 17 2006) on Java 1.6 (1.6.0-rc-b102) on WinXP-SP2. Error does occur. :-( I have also verified that this occurs under 1.6.4. -peter I have added an new attribute to the javac task - includeDestClasses. This is by default set to true - in which case the javac task includes the destination directory in the classpath parameter given to javac command (default behaviour), if set to false, this will not happen. the build file: <project name="Test" default="build"> <presetdef name="compile"> <javac srcdir="src" destdir="bin" target="1.5" source="1.5" debug="true" includeDestClasses="false" listfiles="true"> </javac> </presetdef> <target name="build"> <mkdir dir="bin"/> <compile/> <delete><fileset dir="bin/test" includes="Test3*.class"/></delete> <compile/> </target> </project> now works. I think there is other "edge cases" for that which are solved by this bug fix: 1- Interface A has a method x with "void" return type. 2- Class B uses an instance that implements interface A, and calls the void method x. from -1. 3- Interface A is refactored and method x to return an Object (not void anymore). 4- Class B is not modified and still compiles: it just call x still with no concern on the returned value. 5- Using javac in Ant, Class B is untouched and not recompiled. At runtime, B fails calling the method x. Forcing recompile of B fixes the runtime problem. Using 1.7.1 with the new attribute includeDestClasses="false" also fixes the problem. |