blob: 1c5aaaaca5ddb87bc3188b86d689ef14aadab242 (
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 HasMethodInherited {
declare parents : D && hasmethod(* print(..)) implements Printable;
public static void main(String[] args) {
C c = new C();
if ((c instanceof Printable)) {
throw new RuntimeException("declare parents : hasmethod failed on super");
}
D d = new D();
if (!(d instanceof Printable)) {
throw new RuntimeException("declare parents : hasmethod failed on sub");
}
}
}
class C {
protected void print() {}
}
class D extends C {
}
interface Printable {};
|