blob: 8f0686ddfe55582c4a800277b18d724f7d23fbdc (
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
|
import java.util.List;
public aspect ErasureMatching {
declare warning : execution(static Object Utils.first(List)) : "static generic method match";
declare warning : execution(Number Utils.max(Number, Number)) : "instance generic method match";
declare warning : execution(public List G.getAllDataItems()) : "method in generic type match";
declare warning : set(Object G.myData) : "field in generic type match";
}
class Utils {
/** static generic method */
static <T> T first(List<T> ts) { return null; }
/** instance generic method */
<T extends Number> T max(T t1, T t2) { return t1; }
}
class G<T> {
// field with parameterized type
T myData = null;
// method with parameterized return type
public List<T> getAllDataItems() { return null; }
}
|