summaryrefslogtreecommitdiffstats
path: root/tests/java5/generics/pointcuts/ArgsParameterizedWithWildcards.aj
blob: dcbd9a90c51f0c9d6ff49b77670c6a85267718f0 (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
40
import java.util.*;

public aspect ArgsParameterizedWithWildcards {

	/*
	 *   - args(List<Double>) matches List, List<?>, List<? extends Number> with unchecked warning
	 *                        matches List<Double>, List<? extends Double> ok (since Double is final)
	 */

	before() : execution(* *(..)) && args(List<Double>) {
		System.out.println("List<Double> matched at " + thisJoinPointStaticPart);
	}
	
	public static void main(String[] args) {
		C c = new C();
		List<Double> ld = new ArrayList<Double>();
		c.rawList(ld);
		c.listOfSomething(ld);
		c.listOfSomeNumber(ld);
		c.listOfDouble(ld);
		c.listOfSomeDouble(ld);
		c.listOfString(new ArrayList<String>());
	}
}

class C {
	
	void rawList(List l) {}
	
	void listOfSomething(List<?> ls) {}
	
	void listOfSomeNumber(List<? extends Number> ln) {}
	
	void listOfDouble(List<Double> ld) {}
	
	void listOfSomeDouble(List<? extends Double> ld) {}
	
	void listOfString(List<String> ls) {}
	
}