Circular advice precedence - how to? [message #815130] |
Wed, 07 March 2012 04:12  |
Eclipse User |
|
|
|
Hi,
I am trying to achieve the following:
I have a annotation: @A except that @A takes a shortcut if a method it is applied to has its first Method parameter of type say, X.
I have two Pointcuts as:
@Pointcut(value="execution(@A * *(..)) " +
"&& @annotation(annotation) ")
public void trackAnnotatedMethod(A annotation) {}
@Pointcut(value="execution(@A * *(" +
"X,..)) &&" +
"args(x,..) && @annotation(annotation) ")
public void splAnnotatedMethodWithX(A annotation, X x) {}
I get the following exception:
circular advice precedence: can't determine precedence between two or more pieces of advice that apply to the same join point: method-execution(...)
When a method similar to the following is annotated with A:
@A
public void someMethod(X x) {..}
Is there a way to do this? Either by changing the aspect or a different way to achieve the same? Thanks for your help,
-Ashish
|
|
|
Re: Circular advice precedence - how to? [message #815683 is a reply to message #815130] |
Wed, 07 March 2012 18:49  |
Eclipse User |
|
|
|
I think you are hitting a variant of this "bug" https://bugs.eclipse.org/bugs/show_bug.cgi?id=30439. I say "bug" and not bug since the compiler behavior is probably correct. I can't say that for certain since you didn't attach your entire aspect.
As the bug states, you can probably get around this by grouping all your before and all your after advice together. Between them should go your around advice.
If this still doesn't work, feel free to attach the complete aspect and a simple target java file.
|
|
|
Powered by
FUDForum. Page generated in 0.03206 seconds