2002-12-16 19:51:06 +01:00
|
|
|
import org.aspectj.testing.Tester;
|
|
|
|
|
|
|
|
class C {
|
|
|
|
public void a() {
|
|
|
|
T.add("a");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-01-14 18:33:36 +01:00
|
|
|
aspect A1 { declare precedence: A1, A2;
|
2002-12-16 19:51:06 +01:00
|
|
|
pointcut cut(): target(C) && execution(void a());
|
|
|
|
|
|
|
|
before(): A1.cut() { T.add("A1"); }
|
|
|
|
}
|
|
|
|
|
2003-01-14 18:33:36 +01:00
|
|
|
aspect A2 { declare precedence: A2, A3;
|
2002-12-16 19:51:06 +01:00
|
|
|
before(): A1.cut() { T.add("A2"); }
|
|
|
|
}
|
|
|
|
|
2003-01-14 18:33:36 +01:00
|
|
|
aspect A3 { declare precedence: A3, A1;
|
2002-12-16 19:51:06 +01:00
|
|
|
before(): A1.cut() { T.add("A3"); }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class T {
|
|
|
|
private static StringBuffer order = new StringBuffer();
|
|
|
|
public static void add(String s) { order.append(s); order.append(':'); }
|
|
|
|
public static void reset() { order = new StringBuffer(); }
|
|
|
|
|
|
|
|
public static void checkAndReset(String expectedValue) {
|
|
|
|
Tester.checkEqual(order.toString(), expectedValue);
|
|
|
|
order.setLength(0);
|
|
|
|
}
|
|
|
|
}
|