Community
Participate
Working Groups
AspectJ Compiler 1.1beta4 This program: aspect Foo { pointcut p1(): execution(void f()) && cflow(execution(void f1())); pointcut p2(): execution(void f()) && cflow(execution(void f2())); before(): p1() { } after(): p1() { } before(): p2() { } after(): p2() { } } class A { void f1() { f(); } void f2() { f(); } void f() { } } results in these errors: circular dependency at method-execution(void A.f()) circular dependency at method-execution(void A.f()) circular dependency at method-execution(void A.f()) circular dependency at method-execution(void A.f()) 4 errors If I comment out any one of the four pieces of advice, all the errors go away. Also, assuming that there is a valid reason for printing this error sometimes, how come there's no line number? --Doug
*** Bug 30438 has been marked as a duplicate of this bug. ***
The error message needs much work. It should say something closer to: can't determine precedence between two pieces of advice that apply to the same join point (method-execution(void A.f())) after@2 > before@1 > before@3 > after@2 I'll leave this as a bug until the error message is improved; however, otherwise the compiler is correct to prohibit this particular aspect You should be able to fix this problem by grouping both of your after advice together lexically, i.e. before p1 before p2 after p1 after p2 The reasons for this are fairly complicated, but have to do with the rules for ordering multiple pieces of advice that can apply to the same join point. See the section on "Advice precedence" in the semantics secton of the programming guide for what might be an explanation. If you still don't fully understand or agree with the issue, please send a message to aspectj-users and either Erik or I will explain in more detail.
Lowering priority and severity as this is only about a better error message.
*** Bug 40655 has been marked as a duplicate of this bug. ***
This program now outputs the following: /home/colyer/tmp/Doug.java:5 error can't determine precedence between two or more pieces of advice that apply the same join point: method-execution(void A. f()) before(): p1() { } ^^^^^^^^^^^ /home/colyer/tmp/Doug.java:6 error can't determine precedence between two or more pieces of advice that apply the same join point: method-execution(void A. f()) after(): p1() { } ^^^^^^^^^^^ /home/colyer/tmp/Doug.java:7 error can't determine precedence between two or more pieces of advice that apply the same join point: method-execution(void A. f()) before(): p2() { } ^^^^^^^^^^^ /home/colyer/tmp/Doug.java:8 error can't determine precedence between two or more pieces of advice that apply the same join point: method-execution(void A. f()) after(): p2() { } ^^^^^^^^^^^ 4 errors Will close the defect once this is available in a published build.
*** Bug 57993 has been marked as a duplicate of this bug. ***
The even better version... /home/colyer/tmp/Doug.java:5 [error] can't determine precedence between two or more pieces of advice that apply to the same join point: method-execution(void A.f()) before(): p1() { } ^^^^^^^^^^^ /home/colyer/tmp/Doug.java:6 [error] can't determine precedence between two or more pieces of advice that apply to the same join point: method-execution(void A.f()) after(): p1() { } ^^^^^^^^^^^ /home/colyer/tmp/Doug.java:7 [error] can't determine precedence between two or more pieces of advice that apply to the same join point: method-execution(void A.f()) before(): p2() { } ^^^^^^^^^^^ /home/colyer/tmp/Doug.java:8 [error] can't determine precedence between two or more pieces of advice that apply to the same join point: method-execution(void A.f()) after(): p2() { } ^^^^^^^^^^^ 4 errors Thanks :)
Fix now available from AspectJ download page.
Fix released as part of AspectJ 1.2.1