org.aspectj/tests/hasmember/HasMethod.aj

19 lines
332 B
Plaintext

public aspect HasMethod {
declare parents : 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");
}
}
}
class C {
public void print() {}
}
interface Printable {};