aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/MethodSelfReference.java
blob: b824bf72af8a7e9e0168fcb9f447061bde3efee3 (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
import org.aspectj.testing.Tester;

/** @testcase PR#776 self-reference from (aspect-declared) method-local class */
public class MethodSelfReference {
    public static void main (String[] args) {
        I it = new I() { public void im() { } };
        it.start();
    }
}

interface I { public void im(); }

aspect A {
    Runnable I.runnable;
    void I.start() {
        class Runner implements Runnable {
            I ri;
            Runner(I i) { ri = i; }
            public void run() { ri.im(); }
        }
        runnable = new Runner(this);
        runnable.run();
    }
}