DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7529>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7529 depend task can't handle nested/inner classes with closure="yes" Summary: depend task can't handle nested/inner classes with closure="yes" Product: Ant Version: 1.4 Platform: PC OS/Version: Windows NT/2K Status: NEW Severity: Normal Priority: Other Component: Optional Tasks AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] It seems that the depend task can't handle nested or inner classes when the closure attribute is set to "yes". The symptom is that it deletes the class files for the outer class and all inner classes even if the class files are all newer than the source file. (Also, note how the I'm running on Window2000. The command output below is from CygWin bash. Here's my source file, <root>/src/test/Outer.class: package test; class Outer { static class Inner { } // class Inner } // class Outer Here's my build.xml file: <project default="default"> <property name="devRoot" value="./" /> <property name="source" value="${devRoot}src" description= "Java source root directory, relative to base, no slash(??) " /> <property name="buildRoot" value="${devRoot}build/" description= "deletable build root directory, relative to base, with slash(??)" /> <property name="obj" value="${buildRoot}classes" /> <path id="path.compile"> <pathelement location="${obj}" /> </path> <target name="compile"> <mkdir dir="${obj}" /> <depend srcdir="${source}" classpathref="path.compile" destdir="${obj}" closure="yes" dump="yes" /> <echo message="" /> <javac srcdir="${source}" classpathref="path.compile" destdir="${obj}" debug="yes" verbose="yes" > </javac> </target> <target name="default" depends="compile"> </target> <target name="clean"> <delete dir="${buildRoot}" /> </target> </project> Below is the file time status and the (trimmed) output of running Ant in debug mode. Note how the depend tasks deletes Outer.class and Outer$Inner.class. Also, note how even though the "ls" command's "-t" option shows that Outer$Inner.class is not older than Outer.class, depend reports: Class test.Outer$Inner is out of date with respect to C:\daniel\work\bugtest\build\classes\test\Outer.class One theory for the cause of the problem is that file times are being compared with "<" instead of "<=", or maybe vice versa (assuming that the file dates are indeed equal, as opposed to just truncated to whole seconds by ls). Another theory is that depend doesn't account for inner classes. If both class file are newer than the source file, it probably shouldn't care if one is newer than the other (or if they have the same time and neither is neither than the other). cd c:/daniel/work/bugtest; ls -ltr `find -name "*Outer*"`; ant -find build.xml -emacs -verbose compile -debug -rw-r--r-- 1 Administ None 110 Mar 27 13:17 ./src/test/Outer.java -rw-r--r-- 1 Administ None 311 Mar 27 13:21 ./build/classes/test/Outer.class -rw-r--r-- 1 Administ None 317 Mar 27 13:21 ./build/classes/test/Outer$Inner.class Ant version 1.4.1 compiled on October 11 2001 Ant version 1.4.1 compiled on October 11 2001 Searching for build.xml ... Buildfile: c:\daniel\work\bugtest\build.xml Setting project property: ant.java.version -> 1.4 Detected Java version: 1.4 in: c:\tools\j2sdk1.4.0\jre Detected OS: Windows 2000 +User task: tar org.apache.tools.ant.taskdefs.Tar ... +User datatype: fileset org.apache.tools.ant.types.FileSet ... Setting project property: java.runtime.name -> Java(TM) 2 Runtime Environment, Standard Edition ... Setting project property: basedir -> C:\daniel\work\bugtest Project base dir set to: C:\daniel\work\bugtest +Task: property Setting project property: devRoot -> ./ +Task: property Setting project property: source -> ./src +Task: property Setting project property: buildRoot -> ./build/ +Task: property Setting project property: obj -> ./build/classes +DataType: path Adding reference: path.compile -> +Target: compile +Task: mkdir +Task: depend +Task: echo +Task: javac +Target: default +Target: clean +Task: delete Build sequence for target `compile' is [compile] Complete build sequence is [compile, default, clean] compile: Adding class info for test.Outer$Inner Adding class info for test.Outer Resource test/Outer$Inner.class loaded from ant loader Class test.Outer depends on C:\daniel\work\bugtest\build\classes\test\Outer$Inner.class due to test.Outer$Inner Resource test/Outer.class loaded from ant loader Class test.Outer$Inner depends on C:\daniel\work\bugtest\build\classes\test\Outer.class due to test.Outer Reverse Dependency Dump for 3 classes: Class test.Outer affects: test.Outer$Inner in C:\daniel\work\bugtest\build\classes\test\Outer$Inner.class Class java.lang.Object affects: test.Outer in C:\daniel\work\bugtest\build\classes\test\Outer.class test.Outer$Inner in C:\daniel\work\bugtest\build\classes\test\Outer$Inner.class Class test.Outer$Inner affects: test.Outer in C:\daniel\work\bugtest\build\classes\test\Outer.class Classpath file dependencies (Forward): Class test.Outer depends on: C:\daniel\work\bugtest\build\classes\test\Outer$Inner.class Class test.Outer$Inner depends on: C:\daniel\work\bugtest\build\classes\test\Outer.class FileSet: Setup file scanner in dir C:\daniel\work\bugtest\src with patternSet{ includes: [] excludes: [] } Class test.Outer$Inner is out of date with respect to C:\daniel\work\bugtest\build\classes\test\Outer.class Deleting file C:\daniel\work\bugtest\build\classes\test\Outer.class since test.Outer$Inner out of date Deleting file C:\daniel\work\bugtest\build\classes\test\Outer$Inner.class since test.Outer out of date Deleted 2 out of date files in 0 seconds FileSet: Setup file scanner in dir C:\daniel\work\bugtest\src with patternSet{ includes: [] excludes: [] } test\Outer.java added as C:\daniel\work\bugtest\build\classes\test\Outer.class doesn't exist. Compiling 1 source file to C:\daniel\work\bugtest\build\classes Using modern compiler Compilation args: -d C:\daniel\work\bugtest\build\classes -classpath C:\daniel\work\bugtest\build\classes;C:\tools\jakarta-ant-1.4.1\lib\junit.jar;C:\tools\jakarta-ant-1.4.1\lib\jaxp.jar;C:\tools\jakarta-ant-1.4.1\lib\jakarta-ant-1.4.1-optional.jar;C:\tools\jakarta-ant-1.4.1\lib\crimson.jar;C:\tools\jakarta-ant-1.4.1\lib\ant.jar;C:\tools\j2sdk1.4.0\lib\tools.jar -sourcepath C:\daniel\work\bugtest\src -g -verbose File to be compiled: C:\daniel\work\bugtest\src\test\Outer.java [parsing started C:\daniel\work\bugtest\src\test\Outer.java] [parsing completed 50ms] [checking test.Outer] [loading c:\tools\j2sdk1.4.0\jre\lib\rt.jar(java/lang/Object.class)] [wrote C:\daniel\work\bugtest\build\classes\test\Outer$Inner.class] [wrote C:\daniel\work\bugtest\build\classes\test\Outer.class] [total 511ms] BUILD SUCCESSFUL Total time: 1 second -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
