mirror of
https://github.com/eclipse-aspectj/aspectj.git
synced 2024-08-15 02:13:50 +02:00
28 lines
500 B
Plaintext
28 lines
500 B
Plaintext
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 {}; |