aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs/fieldsOnInterfaces/IntFieldOnInterface.java
blob: 9d9f7e205ee6189f04c3eb567ce05633a0fba647 (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.Tester;

/** @testcase PR#52107 declare int field on interface */
public class IntFieldOnInterface implements Runnable {
    public static final int caseid = 2;
	public static void main(String[] args) {
		Tester.expectEvent("A name=2");
        Tester.expectEvent("R name=2");
        IntFieldOnInterface test
            = new IntFieldOnInterface();
        test.run();
        test.blah();
		Tester.checkAllEvents();
	}
	public void run() {
        switch (name) {
            case (IntFieldOnInterface.caseid) :
                Tester.event("R name=" + name);
                break;
            default :
                throw new Error("bad switch");
        }
	}
}

aspect A {
	public int Runnable.name = IntFieldOnInterface.caseid;
	public void Runnable.blah() {
		switch (name) {
			case (IntFieldOnInterface.caseid) : 
				Tester.event("A name=" + name);
				break;
			default :
				throw new Error("bad switch");
		}
	}
}