aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/ArgsInCflowCf.java
blob: 21ec256b6c54f7186f220a4f49bf2613ac276b30 (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
import org.aspectj.testing.*;

/** PR#660 name binding in around cflow */
public class ArgsInCflowCf {
    public static void main(String[] args) {
        Tester.check(3==foo(1), "3==foo(1)");
        Tester.checkAllEvents();
    }
    static int foo(int x) {return bar(x+1);}
    static int bar(int x) {return x+1;}

    static { 
        Tester.expectEvent("1-2");
    }
}

aspect Test {
    int around(int x, int y) : // ERR not final
        cflow(call(int foo(int)) && args(x))
        && call(int bar(int)) && args(y) {
        Tester.event(x + "-" + y);
        return proceed(x,y);
    }
    int around(final int x, int y) : 
        cflow(call(int foo(int)) && args(x))
        && call(int bar(int)) && args(y) {
        Tester.event(x + "-" + y);
        return proceed(y,y); // ERR simple refs
    }
    int around(final int x, int y) : 
        cflow(call(int foo(int)) && args(x))
        && call(int bar(int)) && args(y) {
        Tester.event(x + "-" + y);
        return proceed(x+1,y+1); // ERR simple refs
    }
}