summaryrefslogtreecommitdiffstats
path: root/tests/new/AdviceOnIntroduced.java
blob: 4a3bba55d70da9dad046459109cd5e18a71d592a (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
import org.aspectj.testing.Tester;

public aspect AdviceOnIntroduced {
    public static void main(String[] args) { test(); }

    public static void test() {
	Tester.checkEqual(new Foo(10).foo(5), 6, "foo");
    }
    
    int Foo.foo(int n) { return n; }
    Foo.new(int w) { this(); }
        
    int around(int n):
        within(AdviceOnIntroduced) &&
        (args(n) && execution(int foo(int))) {
            int result = proceed(n);
            return result+1;
        }
    
    before(): within(Foo) && execution(new(..)) {
	//System.out.println("before new");
    }
}

class Foo {
}