Community
Participate
Working Groups
Eclipse 3.1.1 AJDT: org.eclipse.aspectj_1.2.1.20050624095428 The NPE seems to occur during an incremental compilation if there is an outstanding error from a previous incremental compilation java.lang.NullPointerException at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1015) 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_aspec tj_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:759) at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild (AjBuildManager.java:249) at org.aspectj.ajdt.internal.core.builder.AjBuildManager.incrementalBuild (AjBuildManager.java:158) at org.aspectj.ajde.internal.CompilerAdapter.compile(CompilerAdapter.java:117) at org.aspectj.ajde.internal.AspectJBuildManager$CompilerThread.run (AspectJBuildManager.java:191) NullPointerException thrown: null 1. Create the attached project 2. Swap the commented lines in SwtThreadSafetey and incrementally compile (save). You will get an error 3. Create a new aspect in the default package
Created attachment 28680 [details] Test project
Over the fence...
This bug is a duplicate of bug 112529. I was able to reproduce the NPE with AJDT 1.3.0.20051003160848, however, not with AJDT 1.3.0.20051019121930. The fix went into AspectJ on 20051014, so any builds available on the AJDT download page should contain the fix. The fix is actually to improve the exception handling, so rather than throwing an NPE, throw a BCException with extra info. With the most recent AspectJ, the exception you now get is: !ENTRY org.eclipse.ajdt.ui 4 0 2005-10-25 11:40:16.883 !MESSAGE BCException thrown: Can't find bcel delegate for ui.views.ViewsThreadSafety type=class org.aspectj.weaver.ReferenceType when weaving aspects when weaving when incrementally building BuildConfig[C:\eclipse_installations\aspectj\eclipse\runtime-workspace-20050923-testcaseInvestigation\.metadata\.plugins\org.eclipse.ajdt.core\websterm.generated.lst] #Files=3 !STACK 0 org.aspectj.weaver.BCException: Can't find bcel delegate for ui.views.ViewsThreadSafety type=class org.aspectj.weaver.ReferenceType when weaving aspects when weaving when incrementally building BuildConfig[C:\eclipse_installations\aspectj\eclipse\runtime-workspace-20050923-testcaseInvestigation\.metadata\.plugins\org.eclipse.ajdt.core\websterm.generated.lst] #Files=3 at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1019) 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:759) at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:249) at org.aspectj.ajdt.internal.core.builder.AjBuildManager.incrementalBuild(AjBuildManager.java:158) at org.aspectj.ajde.internal.CompilerAdapter.compile(CompilerAdapter.java:117) at org.aspectj.ajde.internal.AspectJBuildManager$CompilerThread.run(AspectJBuildManager.java:191)
Created attachment 28752 [details] patch containing failing testcase Apply the patch to the tests project. This produces an exception of the form: org.aspectj.weaver.BCException: Can't find bcel delegate for pack1.A1 type=class org.aspectj.weaver.ReferenceType when weaving aspects when weaving when incrementally building BuildConfig[C:\eclipse_installations\ajdt_3_1_0_development\eclipse\workspace-bugs20050818\.metadata\.plugins\org.eclipse.ajdt.core\test.generated.lst] #Files=3 at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1019) 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:759) at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:249) at org.aspectj.ajdt.internal.core.builder.AjBuildManager.incrementalBuild(AjBuildManager.java:158) at org.aspectj.ajde.internal.CompilerAdapter.compile(CompilerAdapter.java:117) at org.aspectj.ajde.internal.AspectJBuildManager$CompilerThread.run(AspectJBuildManager.java:191)
excellent work Helen ! I still need to puzzle through what it means tho :(
I've checked in the test patch from Helen. Currently commented out in MultiProjectIncrementalTests
Right. fix checked in. when the compile error occurs on the intermediate compile we are left with a referencetype containing an eclipse source type (implementation of delegate) that records the errors - if there were no errors it would have become a bcel delegate which can be woven. On the third compile we get hold of the reference type and ask for its bcel delegate - this return NULL since it doesnt have one, it still has an eclipsesourcetype delegate. Given that we can only have not transformed it into a bcel delegate if there was an error during compilation, I'm allowing the weaving process to skip weaving the type for which it cant find the bcel delegate. this works fine ;) fix checked in.
fix available.