Community
Participate
Working Groups
public class Foo{ public static void method(){ } public static void main(String[] args){ method(); } } public aspect CFlowAspect { pointcut cflowMethod1(): cflow (execution(void Foo.method())); before(): cflowMethod1(){ System.out.println("Before : " + thisJoinPoint); } } The code above seems to cause StackOverFlowError at com.aspectj.test.CFlowAspect.ajc$before$com_aspectj_test_CFlowAspect$1$1b9bf60(CFlowAspect.aj) at com.aspectj.test.CFlowAspect.ajc$before$com_aspectj_test_CFlowAspect$1$1b9bf60(CFlowAspect.aj) at com.aspectj.test.CFlowAspect.ajc$before$com_aspectj_test_CFlowAspect$1$1b9bf60(CFlowAspect.aj) .......... .......... at com.aspectj.test.CFlowAspect.ajc$before$com_aspectj_test_CFlowAspect$1$1b9bf60(CFlowAspect.aj) at com.aspectj.test.CFlowAspect.ajc$before$com_aspectj_test_CFlowAspect$1$1b9bf60(CFlowAspect.aj)
Passing to AspectJ compiler
Mohan, I think your advice might be advising itself. That can cause a StackOverFlowError (like with infinite recursion). Try adding something like "!within(CFlowAspect)" to your pointcut.
yep - i agree with Matt - you need to extend your pointcut to prevent advising your advice.
Yes. Apology. This code works. public aspect CFlowAspect { pointcut cflowMethod1(): cflow (execution(void Foo.method())) && !within(CFlowAspect); before(): cflowMethod1(){ System.out.println("Before : " + thisJoinPoint); } }
issued resolved as per previous comment by Mohan