blob: d483a18855f04451da738872d2162f3ca3828bd5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
class OverloadedPointcutsInAspect {
public static void main(String[] args) {
new C().run();
}
}
class C {
public void run() {}
}
aspect A {
declare parents: C implements Runnable;
declare parents: C implements SubRunnable;
interface SubRunnable extends Runnable {}
pointcut pc(Runnable r) : target(r) && call(void run());
pointcut pc(SubRunnable r) : target(r) && call(void run());
before(Runnable r) : pc(r) { log("pc(Runnable r)"); }
before(SubRunnable r) : pc(r) { log("pc(SubRunnable r)"); }
before() : pc(Runnable) { log("pc(Runnable)"); }
before() : pc(SubRunnable) { log("pc(SubRunnable)"); }
before() : pc(*) { log("pc(*)"); }
void log(String s) { System.out.println(s); }
}
|