aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/Finals.java
blob: 9ee0d5e7797714efe4d666f75450a8664a2ac3d4 (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
import org.aspectj.testing.*;
public class Finals {
    public static void main(String[] args) {
        new Finals().go(args);
        Tester.checkAllEvents();
    }

    static {
        Tester.expectEventsInString("go,i1,i2");
    }

    void go(String[] args) {
        Tester.event("go");
    }
}

interface I {
    public void i();
}
aspect Aspect {
    pointcut p1(): call(void go(..)) && target(Finals);
    void around(): p1() {
        new I() {
                public void i() {
                    a("i1");
                    proceed();
                }
            }.i();
    }

    pointcut p2(String[] argss): call(void go(String[])) && args(argss) && target(Finals);
    void around(final String[] argss): p2(argss) {
        new I() {
                public void i() {
                    a("i2");
                    proceed(argss);
                }
            }.i();
    }
    
    static void a(String s) { Tester.event(s); }
}