aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/aroundinner/RunnableSub.java
blob: 0feef3a293abfc7832d675451458576c562f6bb4 (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
public class RunnableSub {
    public static void main (String[] args) {
        Target.main(args);
    } 
}

interface MyRunner extends Runnable {}

aspect Aspect {
    static final String[] SIGNALS = new String[] 
    { "around - start"
    , "around - run - before proceed"
    , "around - run - after proceed"
    };

    // introduced field on interface
    int MyRunner.result; 

    /** @testcase PR#620 around advice inner Runnable (subinterface) running proceed and writing field introduced on subinterface */
    int around(): Target.pointcutTarget() {
        MyRunner runner = new MyRunner() {
                public void run() {
                    Common.signal(SIGNALS[1]);
                    result = proceed(); // remove to avoid bug
                    Common.signal(SIGNALS[2]);
                }
            };
        runner.run();
        Common.signal(SIGNALS[0]);
        return runner.result; // remove to avoid bug
    }    
}