Bug 29934 - runtime NullPointerException when applying around advice to other around advice
Summary: runtime NullPointerException when applying around advice to other around advice
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Jim Hugunin CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-01-21 20:13 EST by Jim Hugunin CLA
Modified: 2003-03-11 19:49 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jim Hugunin CLA 2003-01-21 20:13:59 EST
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();
    }
}
Comment 1 Jim Hugunin CLA 2003-03-11 19:49:11 EST
fixed in current tree, fix is to not inline around advice that has
other around advice applied to it