blob: f807605b1d98b0759d77c8140225abf2449252db (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
import org.aspectj.testing.Tester;
public class CallsAndLocalClasses {
public static void main(String[] args) {
Runnable r = new Outer().makeRunnable();
r.run();
Outer o = new Outer();
o.toString();
((Comparable)o).toString();
Tester.check("run from Outer");
Tester.check("m");
Tester.check("before run");
Tester.check("before m");
}
}
class Outer implements Comparable {
public int compareTo(Object other) { Tester.note("m"); return 0; }
public Runnable makeRunnable() {
return new Runnable() {
public void run() {
Tester.note("run from Outer");
compareTo(this);
}
};
}
}
final class Foo {
public String toString() { return "Foo"; }
}
aspect A {
before(): call(void Runnable.run()) {
Tester.note("before run");
}
before(): call(int compareTo(Object)) {
Tester.note("before m");
}
before(): call(String Object.toString()) {
System.out.println("before toString");
}
}
|