aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/InnerMethods.java
blob: 1172f6162daa0bd63c5efeeac10fa6671ba9c2d3 (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
import org.aspectj.testing.Tester;

public class InnerMethods {
    public static void main(String[] args) {
	Tester.checkEqual(new Sub().new SubInner().f(2), 21);

	Tester.check("ran before calls advice");
    }
}

class Super {
    protected int m(int j) { return j*10; }

}

interface I {
    int x = 1;
}

class Sub extends Super implements I {
    protected int m(int i) { return i; }

    class SubInner extends Super {
        int f(int jj) {
	    return this.m(jj) + x;
	}
    }
}

aspect A {
    before (): call(int Super.m(int)) {
	Tester.note("ran before calls advice");
    }
}