/* who's advice should I take? */ public class afourth { public void f() { System.out.println("f being executed"); } public static void main(String[] args) { afourth app = new afourth(); app.f(); } } aspect as1 { pointcut callf() : call(void afourth.f()); /* ordering of advice execution is by the order in file */ before() : callf() { System.out.println("as1 before advice2"); } before() : callf() { System.out.println("as1 before advice1"); } } aspect as2 { pointcut callf() : call(void afourth.f()); before() : callf() { System.out.println("as2 before advice"); } } aspect controllingaspect { declare precedence : as1, as2; // as1's advice has precedence // declare precedence as1,*; // give precedence to as1 over other aspects } /* conflicting precedence declarations won't compile... aspect c2 { declare precedence : as2, as1; } */