Project: AspectJ
Bug 124399 AJDT AspectJ Internal Compiler Error
Reported: 2006-01-18 16:59:18 | Status: resolved fixed

In Eclipse 3.1.1 with AJDT 1.3 (the December 20th 2005 release) I got this message in an error dialog: org.aspectj.weaver.BCException at org.aspectj.weaver.bcel.LazyClassGen.getLazyMethodGen(LazyClassGen.java:1216) at org.aspectj.weaver.bcel.LazyClassGen.getLazyMethodGen(LazyClassGen.java:1201) at org.aspectj.weaver.bcel.BcelShadow.weaveAroundInline(BcelShadow.java:2048) at org.aspectj.weaver.bcel.BcelAdvice.implementOn(BcelAdvice.java:232) at org.aspectj.weaver.Shadow.implementMungers(Shadow.java:588) at org.aspectj.weaver.Shadow.implement(Shadow.java:405) at org.aspectj.weaver.bcel.BcelClassWeaver.implement(BcelClassWeaver.java:2146) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:467) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:102) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1543) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1494) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1275) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1097) at org.aspectj.ajdt.internal.compiler.AjCompilerAdapter.weave(AjCompilerAdapter.java:300) at org.aspectj.ajdt.internal.compiler.AjCompilerAdapter.afterCompiling(AjCompilerAdapter.java:178) at org.aspectj.ajdt.internal.compiler.CompilerAdapter.ajc$afterReturning$org_aspectj_ajdt_internal_compiler_CompilerAdapter$2$f9cc9ca0(CompilerAdapter.aj:70) at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:367) at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:811) at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:254) at org.aspectj.ajdt.internal.core.builder.AjBuildManager.incrementalBuild(AjBuildManager.java:163) at org.aspectj.ajde.internal.CompilerAdapter.compile(CompilerAdapter.java:117) at org.aspectj.ajde.internal.AspectJBuildManager$CompilerThread.run(AspectJBuildManager.java:191) trouble in: public class edu.ucsd.aosd.MyApplication extends java.lang.Object: public void <init>(): ALOAD_0 // edu.ucsd.aosd.MyApplication this (line 5) INVOKESPECIAL java.lang.Object.<init> ()V constructor-execution(void edu.ucsd.aosd.MyApplication.<init>()) | RETURN constructor-execution(void edu.ucsd.aosd.MyApplication.<init>()) end public void <init>() public static void main(String[]) org.aspectj.weaver.MethodDeclarationLineNumber: 8:124 : method-execution(void edu.ucsd.aosd.MyApplication.main(java.lang.String[])) | ALOAD_0 // java.lang.String[] args (line 9) | ASTORE 4 | ICONST_0 | ISTORE_2 | ALOAD 4 | ARRAYLENGTH | ISTORE_3 | GOTO L1 | L0: ALOAD 4 | ILOAD_2 | AALOAD | ASTORE_1 | GETSTATIC java.lang.System.out Ljava/io/PrintStream; (line 10) | NEW java.lang.StringBuilder | DUP | LDC "got: " | INVOKESPECIAL java.lang.StringBuilder.<init> (Ljava/lang/String;)V | ALOAD_1 // java.lang.String arg | method-call(java.lang.StringBuilder java.lang.StringBuilder.append(java.lang.String)) | | INVOKEVIRTUAL java.lang.StringBuilder.append (Ljava/lang/String;)Ljava/lang/StringBuilder; | method-call(java.lang.StringBuilder java.lang.StringBuilder.append(java.lang.String)) | method-call(java.lang.String java.lang.StringBuilder.toString()) | | INVOKEVIRTUAL java.lang.StringBuilder.toString ()Ljava/lang/String; | method-call(java.lang.String java.lang.StringBuilder.toString()) | ASTORE 5 | ASTORE 6 | method-call(void java.io.PrintStream.println(java.lang.String)) | | ALOAD 6 | | ALOAD 5 | | INVOKEVIRTUAL java.io.PrintStream.println (Ljava/lang/String;)V | method-call(void java.io.PrintStream.println(java.lang.String)) | GETSTATIC java.lang.System.out Ljava/io/PrintStream; (line 11) | LDC "got: %s\n" | ICONST_1 | ANEWARRAY java.lang.Object | DUP | ICONST_0 | ALOAD_1 // java.lang.String arg | AASTORE | method-call(java.io.PrintStream java.io.PrintStream.printf(java.lang.String, java.lang.Object[])) | | INVOKEVIRTUAL java.io.PrintStream.printf (Ljava/lang/String;[Ljava/lang/Object;)Ljava/io/PrintStream; | method-call(java.io.PrintStream java.io.PrintStream.printf(java.lang.String, java.lang.Object[])) | POP | IINC 2 1 (line 9) | L1: ILOAD_2 | ILOAD_3 | IF_ICMPLT L0 | RETURN (line 13) method-execution(void edu.ucsd.aosd.MyApplication.main(java.lang.String[])) end public static void main(String[]) end public class edu.ucsd.aosd.MyApplication when implementing on shadow method-call(void java.io.PrintStream.println(java.lang.String)) when weaving type edu.ucsd.aosd.MyApplication when weaving classes when weaving when incrementally building BuildConfig[C:\EclipseWorkspace\.metadata\.plugins\org.eclipse.ajdt.core\AspectJSemanticsTest.generated.lst] #Files=2 It occured when I editing this file, in an AspectJ project with an recently renamed .aj extension: package edu.ucsd.aosd; import java.io.PrintStream; public class MyApplication { // main public static void main(String[] args) { for (String arg : args) { System.out.println("got: " + arg); System.out.printf("got: %s\n", arg); } } } aspect Printing { pointcut printlnCalls(PrintStream ps, String out): call(* PrintStream+.println(String)) && target(ps) && args(out); Object around(PrintStream ps, String out): printlnCalls(ps, out) && !adviceexecution() { return proceed(ps, out); } pointcut printfCalls(PrintStream ps, String fmt, Object[] objs): call(* PrintStream+.printf(String, Object...#####)) && target(ps) && args(fmt, objs); } Where "#####" is where my cursor was when I saved. My previously saved version didn't have the printfCalls pointcut nor the call to printf in the main. (Thus, you might want to try the println version first, save it, and then make the new additions. Though, I hope the debug information is enough.)

Files changed in fix:
tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java