Project: AspectJ
Bug 29934 runtime NullPointerException when applying around advice to other around advice
Reported: 2003-01-21 20:13:59 | Status: resolved fixed

When the program below is run, it produces a NullPointerException... java.lang.NullPointerException at A2.ajc$around$A2$3b6proceed(CflowCycles.java) at A2.ajc$around$A2$3b6_aroundBody3(CflowCycles.java:35) at Target.run(CflowCycles.java:24) at CflowCycles.run_aroundBody4(CflowCycles.java:8) at CflowCycles.main_aroundBody6(CflowCycles.java:24) at CflowCycles.main(CflowCycles.java:24) ---(in new/CflowCycles.java and in ajcTestsFailing.xml) import org.aspectj.testing.Tester; /** @testcase cflow cycles in advice from different aspects */ public class CflowCycles { public static void main( String args[] ) { Tester.expectEvent("target A1"); Tester.expectEvent("target A2"); new Target().run(); Tester.checkAllEventsIgnoreDups(); } } class Target { public void run(){ } } aspect A1 { pointcut TargetRunFlow () // ok if no cflow: within(Target) && execution(* *(..)) && !within (A1+); : !within(A1+) && !preinitialization(new(..)) && !initialization(new (..))//cflow(within(Target) && execution(* *(..))) && !within(A1+) ; Object around () : TargetRunFlow() { Tester.event("target A1"); return proceed(); } // ok if in the same class } aspect A2 { pointcut TargetRun () : within(Target) && execution(* *(..)) && !within(A2+); ; Object around () : TargetRun() { Tester.event("target A2"); return proceed(); } }

Files changed in fix:
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java