Community
Participate
Working Groups
In the following sample, the advice defined in "other_aspect" does not pick up the execution of around advice defined in "some_aspect". It matches only against the before advice defined in "some_aspect". The implicit AroundClosure parameter of an around advice seems to come in the way of args() matching. ------------------------------------------------------ aspect some_aspect { pointcut call_m(int a, int b) : call(int test.m(..)) && args(a, b); before(int x, int y) : call_m(x, y) { ... } int around(int x, int y) : call_m(x, y) { ... } } aspect other_aspect { before(int x, int y) : adviceexecution() && within(some_aspect) && args(x, y){ ... } } -------------------------------------------------------- AspectJ doc has to state this explicitly.
This is a bug, not a misdocumentation. I've moved this back to compiler and cc'd myself on it in case I get enough time to fix the bug. I've verified that this is still a bug in 1.2 with the following test that I should check in as a test case: public class Test { public static void main(String[] args) { m(3, 4); } static void m(int x, int y) { } } aspect some_aspect { pointcut call_m(int a, int b) : call(void Test.m(..)) && args(a, b); before(int x, int y) : call_m(x, y) { System.err.println("b4"); } void around(int x, int y) : call_m(x, y) { System.err.println("arn"); } } aspect other_aspect { before(int x, int y) : adviceexecution() && within(some_aspect) && args(x, y){ System.err.println("exec"); } } The args of an around advice should be the formal arguments listed, not including the magic closure argument. I've P4d the bug since I think it unlikely in the extreme that people in the wild are using adviceexecution at all, much less with args.
marked as target AJ5 M4
fixed in tree, fix will be available in next published build on AspectJ download page later on today.