Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-dev] Circular Advice Precedence Error

I have two aspects:

public abstract aspect Print {

        declare precedence : Print, *;

public pointcut abstract setOfFunctions( Object o );
before( Object o ) : setOfFunctions( o )  {
System.out.println( "before [" + Thread.currentThread().getName() + "] [" + o + "] " + thisJoinPointStaticPart );
}

after( Object o ) : setOfFunctions( o )  {
System.out.println( "after [" + Thread.currentThread().getName() + "] [" + o + "] "  + thisJoinPointStaticPart );
}
void around( Object o )  : setOfFunctions( o )  {
System.out.println( "around enter [" + Thread.currentThread().getName() + "] [" + o + "] " + thisJoinPointStaticPart );
proceed(o);
System.out.println( "around enter [" + Thread.currentThread().getName() + "] [" + o + "] " + thisJoinPointStaticPart );
}
}

public abstract aspect AbstractReadOnlyConfigurableAspect { 
public interface IReadOnlyConfigurable {
boolean isReadOnly();
}
public abstract pointcut protectedArea( IReadOnlyConfigurable object );

void around( IReadOnlyConfigurable object ) : protectedArea( object )  {
if( object.isReadOnly() ) {
} else {
proceed( object );
}
}
}

Together, they gave me compilation error - circular advice precedence: can't determine precedence between two or more pieces of advice that apply to the same join point: method-execution(void org.talz.domain.Order.setP1(java.lang.String)).

If I comment out the before and after advice in Print, the code compiles.
If I comment out the around advice in Print, the code also compiles.

What is the reason of this behavior?  I'd expect the before advice to execute before the around advices which execute before the after advice.

Thanks!

Back to the top