aboutsummaryrefslogtreecommitdiffstats
path: root/tests/java5/generics
diff options
context:
space:
mode:
authoraclement <aclement>2005-07-29 14:05:05 +0000
committeraclement <aclement>2005-07-29 14:05:05 +0000
commit9566ac2e6de5f1edc91425cd47966b137b41a4ee (patch)
tree526b079462a3da54d2c6ebc3b1762d1e053ead50 /tests/java5/generics
parent14b0f911d8452c172e037d2db88f082b2f0c3bb4 (diff)
downloadaspectj-9566ac2e6de5f1edc91425cd47966b137b41a4ee.tar.gz
aspectj-9566ac2e6de5f1edc91425cd47966b137b41a4ee.zip
genericitds: the possibilities are endless.
Diffstat (limited to 'tests/java5/generics')
-rw-r--r--tests/java5/generics/itds/GenericMethodITD3.aj12
-rw-r--r--tests/java5/generics/itds/GenericMethodITD4.aj20
-rw-r--r--tests/java5/generics/itds/GenericMethodITD5.aj20
-rw-r--r--tests/java5/generics/itds/GenericMethodITD6.aj19
-rw-r--r--tests/java5/generics/itds/ParameterizedMethodITD3.aj20
-rw-r--r--tests/java5/generics/itds/ParameterizedMethodITD4.aj20
6 files changed, 105 insertions, 6 deletions
diff --git a/tests/java5/generics/itds/GenericMethodITD3.aj b/tests/java5/generics/itds/GenericMethodITD3.aj
index f12c39c37..17c4c58d9 100644
--- a/tests/java5/generics/itds/GenericMethodITD3.aj
+++ b/tests/java5/generics/itds/GenericMethodITD3.aj
@@ -5,16 +5,16 @@ class Base { }
public class GenericMethodITD3 {
public static void main(String[] argv) {
- List<A> as = new ArrayList<A>();
- List<B> bs = new ArrayList<B>();
- Base.simple(as,bs);
+ List<A> as1 = new ArrayList<A>();
+ List<A> as2 = new ArrayList<A>();
+ new Base().simple(as1,as2); // ok, both List<A>
}
- class A {}
- class B extends A {}
}
+class A {}
+class B extends A {}
aspect X {
- <E> void Base.simple(List<E> one,List<? extends E> two) {}
+ <E> void Base.simple(List<E> one,List<E> two) {}
}
diff --git a/tests/java5/generics/itds/GenericMethodITD4.aj b/tests/java5/generics/itds/GenericMethodITD4.aj
new file mode 100644
index 000000000..de69c92a7
--- /dev/null
+++ b/tests/java5/generics/itds/GenericMethodITD4.aj
@@ -0,0 +1,20 @@
+import java.util.*;
+
+class Base { }
+
+public class GenericMethodITD4 {
+
+ public static void main(String[] argv) {
+ List<A> as = new ArrayList<A>();
+ List<B> bs = new ArrayList<B>();
+ new Base().simple(as,bs);
+ }
+
+ class A {}
+ class B extends A {}
+}
+
+
+aspect X {
+ <A,B> void Base.simple(List<A> one,List<B> two) {}
+}
diff --git a/tests/java5/generics/itds/GenericMethodITD5.aj b/tests/java5/generics/itds/GenericMethodITD5.aj
new file mode 100644
index 000000000..778b0342c
--- /dev/null
+++ b/tests/java5/generics/itds/GenericMethodITD5.aj
@@ -0,0 +1,20 @@
+import java.util.*;
+
+class Base { }
+
+public class GenericMethodITD5 {
+
+ public static void main(String[] argv) {
+ List<A> as = new ArrayList<A>();
+ List<B> bs = new ArrayList<B>();
+ new Base().simple(as,bs);// error, first is List<A>, second is List<B>
+ }
+
+}
+
+class A {}
+class B extends A {}
+
+aspect X {
+ <E> void Base.simple(List<E> one,List<E> two) {}
+}
diff --git a/tests/java5/generics/itds/GenericMethodITD6.aj b/tests/java5/generics/itds/GenericMethodITD6.aj
new file mode 100644
index 000000000..282df4c8b
--- /dev/null
+++ b/tests/java5/generics/itds/GenericMethodITD6.aj
@@ -0,0 +1,19 @@
+import java.util.*;
+
+class Base { }
+
+public class GenericMethodITD6 {
+
+ public static void main(String[] argv) {
+ List<Double> as = new ArrayList<Double>();
+ new Base().simple(as); // ok, Double extends Number
+ }
+}
+
+class Super {}
+
+class A extends Super {}
+
+aspect X {
+ <E extends Number> void Base.simple(List<? extends E> list) {}
+}
diff --git a/tests/java5/generics/itds/ParameterizedMethodITD3.aj b/tests/java5/generics/itds/ParameterizedMethodITD3.aj
new file mode 100644
index 000000000..806c48c48
--- /dev/null
+++ b/tests/java5/generics/itds/ParameterizedMethodITD3.aj
@@ -0,0 +1,20 @@
+import java.util.*;
+
+class Base { }
+
+public class ParameterizedMethodITD3 {
+
+ public static void main(String[] argv) {
+ List<B> bs = new ArrayList<B>();
+ new Base().simple(bs); // error: B is not a super type of A
+ }
+}
+
+class A {}
+
+class B extends A {}
+
+
+aspect X {
+ void Base.simple(List<? super A> list) {}
+}
diff --git a/tests/java5/generics/itds/ParameterizedMethodITD4.aj b/tests/java5/generics/itds/ParameterizedMethodITD4.aj
new file mode 100644
index 000000000..a3bb7b76d
--- /dev/null
+++ b/tests/java5/generics/itds/ParameterizedMethodITD4.aj
@@ -0,0 +1,20 @@
+import java.util.*;
+
+class Base { }
+
+public class ParameterizedMethodITD4 {
+
+ public static void main(String[] argv) {
+ List<A> as = new ArrayList<A>();
+ new Base().simple(as); // ok, A is a supertype of B
+ }
+}
+
+class A {}
+
+class B extends A {}
+
+
+aspect X {
+ void Base.simple(List<? super B> list) {}
+}