summaryrefslogtreecommitdiffstats
path: root/tests/pureJava/InnerAccess.java
blob: 3bf40b3a6de50d30ed0cba5ecca347bda951fb97 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import org.aspectj.testing.Tester;

import java.util.*;

public class InnerAccess {
    public static void main(String[] args) {
	Tester.checkEqual(new C().getCount(), 3);
    }
}


class C {
    protected int i = 2;
    private String s = "hi";

    Runnable r = new Runnable() {
	    public void run() {
		s += "s";       
	    }
	};

    public int getCount() {
	return new Object() {
		public int m() {
		    r.run();
		    return s.length();
		}
	    }.m();
    }
}

class DI extends D.Inner {
}


class D implements Map.Entry {
    public Object getKey() { return null; }
    public Object getValue() { return null; }
    public Object setValue(Object o) { return o; }

    static class Inner {}
}


class Outer {
    class Middle {
	class Inner {
	    void m() {
		Inner.this.m1();
		Middle.this.m1();
		Outer.this.m1();
	    }

	    void m1() {}
	}
	void m1() {}
    }
    void m1() {}
}