org.aspectj/tests/bugs162/pr145391/GenericType.java
2008-08-20 20:47:14 +00:00

38 lines
1.0 KiB
Java

public class GenericType<V extends Integer> {
public GenericType(V value) {}
public void foo() {}
//
// public void bar() {}
protected V getValue() {
return null;
}
public static void main(String[] args) {
new GenericType<Integer>(null).foo();
}
}
aspect SomeAspect {
before(GenericType t): call(* GenericType.foo()) && target(t) {
// Direct call to non-generic method works
// t.bar();
// Indirect call to non-generic method works
// t.callNormalMethod();
// Direct call to generic method works
// t.getValue();
// Indirect call to generic method produces a NoSuchMethodError
t.callGenericMethod();
}
// private void GenericType.callNormalMethod() {
// bar();
// }
private void GenericType.callGenericMethod() {
getValue();
}
}