Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] precedence inside a single aspect

Hi

The compiler reports that I have circular advice precedence.
If either before/after/around is commented out it compiles.

If we move after and p2 to a different aspect and define
precedence between the two aspects it works.

Is it possible to get this working without moving p2 to a different aspect.

best wishes,
D

Again this is just an example to try out how aspectj works, so please do not try to make sense from it.

package info.caforge.aspectj.model.advice;
public class Preced {
    public String foo(){
        System.err.println("foo");
        return "foor";
    }
}

package info.caforge.aspectj.aspects;
import info.caforge.aspectj.model.advice.Preced;
public aspect Precedence {
    pointcut p1() : execution(String Preced.foo());
    pointcut p2() : execution(String Preced.foo());
   
    before () : p1(){
        System.err.println("before");
    }
    after () : p2(){
        System.err.println("after");
    }
    String around () : p1(){
        System.err.println("around in");
        proceed();
        System.err.println("around out");
        return "around";
    }
   
    //declare precedence: Precedence.p1, Precedence.p2;
}

Back to the top