[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] "can't determine precedence"

Hi -
Your code is incomplete since it only shows one advice from one concrete
aspect; you must have another concrete aspect extending Tracing if in fact
commenting out the advice in the absract aspect Tracing makes a difference
(or there's a bug in ajc).
Precedence determination fails only when the precedence rules result in cycles
when applied to the advice at a join point (I thought the message used to state
as such?), so check out the programming guide section on point as cited by George. 
A simple way to avoid most cycles is to put all "after" advice in an aspect after
"around" and "before" advice.  Just be sure that's the precedence you want.
I should add that there's a debate about relying on advice precedence for
correctness.  In some cases, it's clearly required, but in others consolidating
two pieces of advice into one make the dependencies more clear.  Declaring
precedence as between aspects can provide some indication, but typically
the developer should enter comments if order really matters, to avoid
accidental functional changes caused by re-ordering advice or aspect hierarchy.
Hope this helps-
------------Original Message------------
From: Andrà Dantas Rocha <ad-rocha@xxxxxxxxxx>
To: aspectj-users@xxxxxxxxxxx
Date: Sun, Dec-12-2004 8:51 AM
Subject: [aspectj-users] "can't determine precedence"
I have 3 aspects:
abstract aspect Tracing {
  pointcut validCalls() : call(* *.*(..)) && !within(aftt..*);
  // removing this advice everything works fine
  after() : validCalls() && if (traceEnabled) {  }
abstract aspect Instrumentation {
  public abstract pointcut operationCall();

  pointcut valid() : cflow(testExecution()) && !cflowbelow(execution (* aftt..*.*(..)));
  pointcut interception() : operationCall() && valid();
  after() : interception() {  }
public aspect Test extends Instrumentation {
  public pointcut operationCall() : call(public static boolean Identifier.verify(java.lang.String));
When compiling I receive the following error (removing the Tracing.after() advice everything works fine):
"can't determine precedence between two or more pieces of advice that apply to the same join point"
What this error means? how can I correct it?