blob: 897e1b729b00e8e7517d8c9a6ac90c3ec1fe9c3c (
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
29
30
31
32
33
34
35
36
37
38
|
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();
}
}
|