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

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

    /** @testcase PR#620 around advice inner Runnable running proceed and writing method-final proxy */
    int around(): Target.pointcutTarget() {
        final Proxy proxy = new Proxy();
        Runnable runner = new Runnable() {
                public void run() {
                    Common.signal(SIGNALS[1]);
                    proxy.result = proceed();
                    Common.signal(SIGNALS[2]);
                }
            };
        runner.run();
        Common.signal(SIGNALS[0]);
        return proxy.result;
    }    
}