Community
Participate
Working Groups
Version: AspectJ Compiler 1.1beta4 The ajc compiler issues a spurious error message and exits with a negative error code when weaving code containing static declaration of a nested class. The compiler seem to write the classfiles correctly but the negative exit status causes problems when e.g. using the AjcCompilerAdapter in ant. To reproduce: 1) Extract the following two files into an empty directory: // File: A.aj: aspect A { pointcut withinTest(): within(Test); pointcut callToHandleOrder() : (withinTest() && call(* handleOrder(..))); Object around(): callToHandleOrder() { return "DUMMY inserted by ASPECT" ; } } // End of File A.aj // File : Test.java public class Test { // Commenting out the static declaration makes everything work OK static { class StaticNestedClass { } } public static void main(String[] args) { System.out.println(new Test().handleOrder("test")); } private String handleOrder(String t) { return t; } } // End of Test.java 2) Compile the files ajc -sourceroots . -verbose Output: ----- compiling c:/aspectj1.1/doc/examples/bug/./A.aj compiling c:/aspectj1.1/doc/examples/bug/./Test.java weaving might need to weave [UnwovenClassFile(null, Test$1$StaticNestedClass), UnwovenClassFile(null, A), UnwovenClassFile(null, Test)](world=true) wrote class file: c:\aspectj1.1\doc\examples\bug\A.class can't find type Test$1 wrote class file: c:\aspectj1.1\doc\examples\bug\Test$1$StaticNestedClass.class wrote class file: c:\aspectj1.1\doc\examples\bug\Test.class 1 error ------
fixed in current tree, test in bugs/WeaveLocal.java This bug had been reported before on the mailing list, but by including a small self-contained test case, this report made the bug easy to reproduce and hence easy to fix. Thanks.