Community
Participate
Working Groups
It appears that ajc 1.2 updates a classfile timestamps even if the compilation fails. This breaks the integration with the Ant build system. E.g. using the ant "javac" task with the Ajc11CompilerAdapter interface, the compilation may fail on the first attempt and succeed on the second attempt, - because ajc has touched the timestamp and Ant hence decides that nothing needs to be recompiled. This did not happen in ajc 1.1. To reproduce: 1. In the examples/observer folder, run a build: ajc -sourceroots . 2. Edit the "Demo.java" class and insert the line "DONT COMPILE" 3. Run the compilation again. The compiler displays the correct error message but the Demo.class file has been updated with the compile-time timestamp.
I do not see this problem using ajc (rather than the Ant task). The behaviour would now seem to be consistent with javac i.e. we compile what we can. The timestamps remain unchanged for the classes that fail to be compiled. It is not peculiar to "-sourceroots" e.g. "ajc observer/*.java" has the same effect. When the syntax error in Demo.java is corrected everything is rebuilt. It seems the problem may lie in the adapter.
I still cannot see that ajc is consistent with javac. E.g. create a standard java class, e.g. class Test {} and store it in "Test.java". Then compile with javac: $ javac Test.java $ ls --full-time Test.class -rwxrwxrwx 1 t539956 mkpasswd 182 Fri Oct 08 13:25:29 2004 Test.class* Then insert some syntax errors in Test.java and recompile with javac $ javac Test.java Test.java:2: <identifier> expected DONT_COMPILE; ^ Test.java:2: cannot resolve symbol symbol : class DONT_COMPILE location: class Test DONT_COMPILE; ^ 2 errors $ ls --full-time Test.class -rwxrwxrwx 1 t539956 mkpasswd 182 Fri Oct 08 13:25:29 2004 Test.class* I.e. javac has not changed the Test.class timestamp Now compile with ajc: $ ajc Test.java C:\aspectj1.2\doc\examples\Test.java:2 [error] Syntax error on token "DONT_COMPILE", VariableDeclarator expected after this token DONT_COMPILE; ^^^^^^^^^ 1 error $ ls --full-time Test.class -rwxrwxrwx 1 t539956 mkpasswd 410 Fri Oct 08 13:28:40 2004 Test.class* Summary: ajc has changed the Test.class timestamp while javac has not.
I believe this is due to the lack of support for '-proceedOnError' which is claimed to be a supported flag. It seems to be defaulting to *ON* which means we write out files even if things go wrong. I am just adding support for it now so it will default to OFF unless you specify -proceedOnError.
Two bugs: 1) -proceedOnError is defaulting to ON regardless of what you pass in. 2) -proceedOnError is ignored when deciding whether to do weaving. We should go into weaving even if there were compile errors *if* proceedOnError was set (see bug 74245). I have modified the options processing to take account of -proceedOnError - the value is stored in the buildconfig object. I have also changed the decision about whether to weave to check the proceedOnError setting. Fix checked in, waiting for build.
Fix available. BUILD COMPLETE - build.383 Date of build: 10/18/2004 23:39:49 Time to build: 113 minutes 41 seconds Last changed: 10/18/2004 13:04:09 Latest good AspectJ jar available at: download.eclipse.org/technology/ajdt/dev/aspectj-DEVELOPMENT.jar
Fix released as part of AspectJ 1.2.1