aboutsummaryrefslogtreecommitdiffstats
path: root/tests/pureJava/InnerSuper.java
blob: c7a1a2c288113d27c2df139348a2dcd07e613c10 (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
43
44
45
import org.aspectj.testing.Tester;

public class InnerSuper {
    public static void main(String[] args) {
	Counter c = new C().makeCounter();
	c.count();
	Tester.checkEqual(c.n, 1, "counted");
    }
}

class C {
    public Counter makeCounter() {
	return new Counter() {
		public void count() {
		    n+=1;
		}
	    };
    }

    public InnerCounter makeInnerCounter() {
	class MyCounter extends InnerCounter {
	    public void count() {
		n += 1;
		toString();
	    }
	    public void lookat(Object o) {
		boolean b = o.equals("abc");
	    }
	}

	return new MyCounter();
    }


    protected class InnerCounter {
	protected int n;
	protected Object o;
    }

}

class Counter {
    protected int n = 0;
    public void count() {}
}