summaryrefslogtreecommitdiffstats
path: root/tests/java5/generics/pointcuts/GenericWildcardsInSignatureMatching.aj
blob: 57618914f68d30d3e85a586b7748fc4756fef42f (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
39
import java.util.*; import java.io.*;

public class GenericWildcardsInSignatureMatching {
	
	List<?> aList = new ArrayList<String>();
	
	void foo(Map<? extends Number,List<List<String>>> map) {
		;
	}
	
	List<? super Double> findOne(List<? super Double> ld) {
		return ld;
	}
	
	void anyOrder(List<? super Double> l) {}
	
}


aspect WildcardMatcher {
	
	declare warning : set(List<?> *) : "set of a list";
	
	declare warning : execution(* foo(Map<? extends Number,List<List<String>>>))
	                  : "exact nested wildcard match";
	
	declare warning : execution(* foo(Map<? extends Object+,List<List+>>))
	                  : "wildcard nested wildcard match";
	
	declare warning : execution(List<? super Double> findOne(List<? super Double>))
	                  : "super";
	
	declare warning : execution(* anyOrder(List<? super Object+>))
	                  : "super wild match";

	declare warning : execution(* anyOrder(List<?>))
    				  : "no match - signature is different";

}