aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/AnonymousSelfReference.java
blob: 5a910622f8eee221a6747b64a2f6d31c58f8e4b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import org.aspectj.testing.Tester;

/** @testcase PR#774 interface self-reference by anonymous instance */
public class AnonymousSelfReference {
    public static void main (String[] args) {
        Tester.expectEvent("run");
        Tester.expectEvent("im");
        I it = new I() { public void im() { Tester.event("im");} };
        it.runnable.run();
        Tester.checkAllEvents();
    }
}

interface I { public void im(); }

aspect A {
    Runnable I.runnable = new Runnable() {
            public void run() { 
                im(); // comment out to avoid VerifyError
                Tester.event("run");
            } 
        };
}