Community
Participate
Working Groups
I haven't yet narrowed it down, but the following advice fails with an error "RuntimeException thrown: Ranges must be updated with an enclosing instructionList" If I make it just advise call(* *(..)), it gives "IllegalStateException thrown: no this" Any ideas what's wrong? I will try to narrow this down tomorrow (as always, simplified standalone versions don't do this)... --- Object around() : call(* *(..)) || execution(* *(..)) || adviceexecution() || call(new(..)) || execution(new(..)) { VirtualDynamicMock vdMock = getFirstMatch(thisJoinPoint); // not handled yet: >1 matches per join point... eventually might need precedence if (vdMock != null) { Invocation jpInvocation = new JpInvocation(thisJoinPoint) { public Object doProceed() { return proceed(); } }; try { return vdMock.mockInvocation(jpInvocation); } catch (Throwable t) { throw new RuntimeException(t); // bad } } else { return proceed(); } }
Here is a simple test program that reproduces the problem: public aspect MockProcessing { public pointcut scope(): !within(MockProcessing); Object around() : scope() && (call(* *(..)) || execution(* *(..)) || adviceexecution() || call(new(..)) || execution(new(..))) { return proceed(); } } class ContractChecking { public static final boolean enabled = Boolean.getBoolean (ContractChecking.class.getName()); } Compiler output: Ranges must be updated with an enclosing instructionList Ranges must be updated with an enclosing instructionList java.lang.RuntimeException: Ranges must be updated with an enclosing instruction List at org.aspectj.weaver.bcel.Range.updateTarget(Range.java:170) at org.aspectj.weaver.bcel.BcelShadow.retargetFrom(BcelShadow.java:230) at org.aspectj.weaver.bcel.BcelShadow.deleteNewAndDup (BcelShadow.java:20 7) at org.aspectj.weaver.bcel.BcelShadow.prepareForMungers (BcelShadow.java: 247) at org.aspectj.weaver.Shadow.implement(Shadow.java:349) at org.aspectj.weaver.bcel.BcelClassWeaver.implement (BcelClassWeaver.jav a:1618) at org.aspectj.weaver.bcel.BcelClassWeaver.weave (BcelClassWeaver.java:38 6) at org.aspectj.weaver.bcel.BcelClassWeaver.weave (BcelClassWeaver.java:92 ) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1267) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump (BcelWeaver.java:1 232) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify (BcelWeaver.java:102 6) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:915) at org.aspectj.ajdt.internal.compiler.AjCompilerAdapter.weave (AjCompiler Adapter.java:244) at org.aspectj.ajdt.internal.compiler.AjCompilerAdapter.afterCompiling (A jCompilerAdapter.java:119) at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile (Compil er.java:385) at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilat ion(AjBuildManager.java:683) at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild (AjBuild Manager.java:168) at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild (AjBu ildManager.java:102) at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:109) at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60) at org.aspectj.tools.ajc.Main.run(Main.java:291) at org.aspectj.tools.ajc.Main.runMain(Main.java:227) at org.aspectj.tools.ajc.Main.main(Main.java:80) 1 fail|abort
thanks to Rons great testcase I've fixed the problem with updating targeters reported - I fixed it under the more recent 109614. The problem was in advising an implicit call to the NoClassDefFoundError ctor that is put into the static initializer. I've fixed it not to crash - but you may need to test it to verify the woven result does what you expect.
presumed fixed - as mentioned in the previous comment.