Community
Participate
Working Groups
Abort with compiler error. Could be reproduced when building project in AJDT as well wenn building via Ant and iajc-task. AJDT Version: 1.2.0 Build id: 20050217151031 AspectJ version: 1.5.0M1 Eclipse 3.1M4 Build id: 200412162000 started with -vmargs -Xmx900M Problem seems to be caused by a certain combination of pointcuts. The order of this pointcuts seems to be important. The problem first showed up in a rather large project built with AJDT 1.2.0 and Eclipse 3.0 Simplified testcase follows.
Created attachment 18379 [details] Simplified Testcase. Weave with BadWormhole.aj to reproduce the bug. This Testcase was extracted out of a real world project. The Advice on the concurrentUsage-pointcut in pack.BadWormhhole triggers the error. (The body of the advice seems to be of no importance). Note that concurrentUsage(Service s) uses the specific type, wheras the referenced pointcut isDynamicService(Main,GenericSerivce) uses a different type (here the supertype). Without this the crash doesn't happen. If there is another pointcut and advice refering to isDynamicService *before* concurrentUsage(Service) and this other pointcut/advice referes to the original type (GenericService), then the crash doesn't happen either. See GoodWormhole.aj as example.
Sorry, forgot to post the Stack Trace: The Exeption is: [iajc] bad [iajc] bad [iajc] org.aspectj.weaver.BCException: bad [iajc] at org.aspectj.weaver.bcel.BcelRenderer.visit(BcelRenderer.java:198) [iajc] at org.aspectj.weaver.ast.Literal.accept(Literal.java:29) [iajc] at org.aspectj.weaver.bcel.BcelRenderer.recur(BcelRenderer.java:145) [iajc] at org.aspectj.weaver.bcel.BcelRenderer.renderTest(BcelRenderer.java:111) [iajc] at org.aspectj.weaver.bcel.BcelAdvice.getTestInstructions(BcelAdvice.java:343) [iajc] at org.aspectj.weaver.bcel.BcelShadow.weaveAroundInline(BcelShadow.java:1605) [iajc] at org.aspectj.weaver.bcel.BcelAdvice.implementOn(BcelAdvice.java:148) [iajc] at org.aspectj.weaver.Shadow.implementMungers(Shadow.java:443) [iajc] at org.aspectj.weaver.Shadow.implement(Shadow.java:326) [iajc] at org.aspectj.weaver.bcel.BcelClassWeaver.implement(BcelClassWeaver.java:1156) [iajc] at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:362) [iajc] at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:83) [iajc] at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:740) [iajc] at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:705) [iajc] at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:632) [iajc] at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:575) [iajc] at org.aspectj.ajdt.internal.compiler.AjCompilerAdapter.weave(AjCompilerAdapter.java:239) [iajc] at org.aspectj.ajdt.internal.compiler.AjCompilerAdapter.afterCompiling(AjCompilerAdapter.java:114) [iajc] at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:383) [iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:671) [iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:167) [iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:101) [iajc] at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:108) [iajc] at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:59) [iajc] at org.aspectj.tools.ajc.Main.run(Main.java:289) [iajc] at org.aspectj.tools.ajc.Main.runMain(Main.java:226) [iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.executeInSameVM(AjcTask.java:1158) [iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.execute(AjcTask.java:955) [iajc] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275) [iajc] at org.apache.tools.ant.Task.perform(Task.java:364) [iajc] at org.apache.tools.ant.Target.execute(Target.java:341) [iajc] at org.apache.tools.ant.Target.performTasks(Target.java:369) [iajc] at org.apache.tools.ant.Project.executeTarget(Project.java:1214) [iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:389) [iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:136) BUILD FAILED: C:\work\Arbeit\BOA\build.xml:130: fail due to BCException "bad""ABORT" (1 exceptions)
scheduled for investigation in aj5m3
Nasty nasty one. My simple case (based on the included example) which shows the problem is: --- package pack; aspect BadWormhole { pointcut isDynamicService(Main mm,Service s): cflowbelow(this(mm)) && if(true==true) && this(s); before(Service s): isDynamicService(*,s) {} } --- if(true==true) is there to ensure we have an if, if we used if(true) it would have been optimized away. We blow up because: 1. cflowbelow refers to mm 2. mm is the first parameter in the pointcut. 3. the before advice refers to the isDynamicService() pointcut but discards the first element, leaving the advice with a single parameter of type 'Service'. still investigating...
we will try to detect this situation and fail more gracefully at the least. the full solution to this requires changing parameter binding which will disturb the codebase more than we really want to for 1.5.0 at this stage. Still with Andy...
Hmmm, I must be getting smarter. Just checked in the fix for this. The problem is when trying to work out the type of the formal deep in the cflow pointcut, we ask the advice - the advice doesnt use the first pointcut parameter (the one bound in the cflow) so we get the wrong type back. (Service, when we should have determined it was of type Main). The fix is to first look at any suitable enclosing pointcuts and if there isn't one, *then* you ask the advice. So in this case we ask "isDynamicService(*,s)" for the type of its first parameter and it says 'Main'. Waiting on build before closing.
fix available.