aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hasmember/HasFieldInherited.aj
blob: bed5b42a0f83c9849443e3d65218f227ab0e6af2 (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
public aspect HasFieldInherited {
	
	declare parents : D && hasfield(* printer) implements Printable; 

	public static void main(String[] args) {
		C c = new C();
		if ((c instanceof Printable)) {
			throw new RuntimeException("declare parents : hasfield failed on super");
		}
		D d = new D();
		if (!(d instanceof Printable)) {
			throw new RuntimeException("declare parents : hasfield failed on sub");
		}
		
	}
}

class C {
	
	String printer;
	
}

class D extends C {
	
}

interface Printable {};