summaryrefslogtreecommitdiffstats
path: root/tests/bugs162
diff options
context:
space:
mode:
authoraclement <aclement>2008-08-21 23:08:04 +0000
committeraclement <aclement>2008-08-21 23:08:04 +0000
commitd9d5f4a7cb2e5675b7be629c633d6abd81b1447a (patch)
treed4fcc4830d6887c35f2a9f53ac10cf43a9308fe4 /tests/bugs162
parent718dcf817024f690582f7328fa4ec48b515f3b25 (diff)
downloadaspectj-d9d5f4a7cb2e5675b7be629c633d6abd81b1447a.tar.gz
aspectj-d9d5f4a7cb2e5675b7be629c633d6abd81b1447a.zip
211146: testcode: generics info lost from itds
Diffstat (limited to 'tests/bugs162')
-rw-r--r--tests/bugs162/pr211146/GenericsLost.java23
-rw-r--r--tests/bugs162/pr211146/GenericsLost2.java13
-rw-r--r--tests/bugs162/pr211146/GenericsLost2Dep.java8
-rw-r--r--tests/bugs162/pr211146/GenericsLost3.java79
-rw-r--r--tests/bugs162/pr211146/GenericsLost4.java28
-rw-r--r--tests/bugs162/pr211146/GenericsLost5.java19
6 files changed, 170 insertions, 0 deletions
diff --git a/tests/bugs162/pr211146/GenericsLost.java b/tests/bugs162/pr211146/GenericsLost.java
new file mode 100644
index 000000000..63631af57
--- /dev/null
+++ b/tests/bugs162/pr211146/GenericsLost.java
@@ -0,0 +1,23 @@
+import java.util.*;
+import java.lang.reflect.*;
+
+aspect Foo {
+
+ public List<String> Goo.getStrings() {
+ return null;
+ }
+
+}
+
+class Goo {
+}
+
+public class GenericsLost {
+
+ public static void main(String[]argv) throws Exception {
+ Method m = Goo.class.getDeclaredMethod("getStrings");
+ Type t = m.getGenericReturnType();
+ if (!t.toString().equals("java.util.List<java.lang.String>"))
+ throw new RuntimeException("Incorrect signature. Signature is "+t);
+ }
+}
diff --git a/tests/bugs162/pr211146/GenericsLost2.java b/tests/bugs162/pr211146/GenericsLost2.java
new file mode 100644
index 000000000..1fc1b155f
--- /dev/null
+++ b/tests/bugs162/pr211146/GenericsLost2.java
@@ -0,0 +1,13 @@
+import java.util.*;
+import java.lang.reflect.*;
+
+aspect Foo {
+
+ public List<String> GenericsLost2.getStrings() {
+ return null;
+ }
+}
+
+class GenericsLost2 {
+}
+ \ No newline at end of file
diff --git a/tests/bugs162/pr211146/GenericsLost2Dep.java b/tests/bugs162/pr211146/GenericsLost2Dep.java
new file mode 100644
index 000000000..71b194a68
--- /dev/null
+++ b/tests/bugs162/pr211146/GenericsLost2Dep.java
@@ -0,0 +1,8 @@
+import java.util.*;
+import java.lang.reflect.*;
+
+public class GenericsLost2Dep {
+ public static void main(String[] args) {
+ new GenericsLost2().getStrings().add("abc");
+ }
+} \ No newline at end of file
diff --git a/tests/bugs162/pr211146/GenericsLost3.java b/tests/bugs162/pr211146/GenericsLost3.java
new file mode 100644
index 000000000..e52ba8cf6
--- /dev/null
+++ b/tests/bugs162/pr211146/GenericsLost3.java
@@ -0,0 +1,79 @@
+import java.util.*;
+import java.lang.reflect.*;
+
+aspect Foo {
+
+ // return type
+ public List<String> Goo.getStrings() {
+ return null;
+ }
+
+ // parameters
+ public void Goo.putStrings(List<String> ls, List<Integer> lls) {
+
+ }
+
+ // type variables
+ public <T extends Number> List<T> Goo.numerics(T t) {
+ return null;
+ }
+
+ // type variables 2
+ public <T extends List<String>> List<T> Goo.nightmare(T t) {
+ return null;
+ }
+
+ // type variables 3
+ public <T extends List<Q>,Q extends Number> List<T> Goo.holyCow(Q t) {
+ return null;
+ }
+}
+
+class Goo {
+}
+
+public class GenericsLost3 {
+
+ public static void main(String[]argv) throws Exception {
+ Method m = Goo.class.getDeclaredMethod("getStrings");
+ Type t = m.getGenericReturnType();
+ if (!t.toString().equals("java.util.List<java.lang.String>"))
+ throw new RuntimeException("Incorrect signature1. Signature is "+t);
+
+
+ m = Goo.class.getDeclaredMethod("putStrings",new Class[]{List.class,List.class});
+ Type[] ps = m.getGenericParameterTypes();
+ if (!ps[0].toString().equals("java.util.List<java.lang.String>"))
+ throw new RuntimeException("Incorrect signature2. Signature is "+t);
+ if (!ps[1].toString().equals("java.util.List<java.lang.Integer>"))
+ throw new RuntimeException("Incorrect signature3. Signature is "+t);
+
+
+ m = Goo.class.getDeclaredMethod("numerics", new Class[]{Number.class});
+ t = m.getGenericReturnType();
+ if (!t.toString().equals("java.util.List<T>"))
+ throw new RuntimeException("Incorrect signature4. Signature is "+t);
+ t = m.getGenericParameterTypes()[0];
+ if (!t.toString().equals("T"))
+ throw new RuntimeException("Incorrect signature5. Signature is "+t);
+
+ m = Goo.class.getDeclaredMethod("nightmare", new Class[]{List.class});
+ t = m.getGenericReturnType();
+ if (!t.toString().equals("java.util.List<T>"))
+ throw new RuntimeException("Incorrect signature4. Signature is "+t);
+ t = m.getGenericParameterTypes()[0];
+ if (!t.toString().equals("T"))
+ throw new RuntimeException("Incorrect signature5. Signature is "+t);
+
+
+ m = Goo.class.getDeclaredMethod("holyCow", new Class[]{Number.class});
+ t = m.getGenericReturnType();
+ if (!t.toString().equals("java.util.List<T>"))
+ throw new RuntimeException("Incorrect signature4. Signature is "+t);
+ t = m.getGenericParameterTypes()[0];
+ if (!t.toString().equals("Q"))
+ throw new RuntimeException("Incorrect signature5. Signature is "+t);
+
+
+ }
+}
diff --git a/tests/bugs162/pr211146/GenericsLost4.java b/tests/bugs162/pr211146/GenericsLost4.java
new file mode 100644
index 000000000..2cdf76dc6
--- /dev/null
+++ b/tests/bugs162/pr211146/GenericsLost4.java
@@ -0,0 +1,28 @@
+import java.util.*;
+import java.lang.reflect.*;
+
+// interface ITD
+aspect Foo {
+ public List<String> IFace.getStrings() {
+ return null;
+ }
+}
+
+interface IFace {}
+
+class Goo implements IFace {}
+
+public class GenericsLost4 {
+ public static void main(String[]argv) throws Exception {
+ Method m = Goo.class.getDeclaredMethod("getStrings");
+ Type t = m.getGenericReturnType();
+ if (!t.toString().equals("java.util.List<java.lang.String>"))
+ throw new RuntimeException("Incorrect signature. Signature is "+t);
+
+ m = IFace.class.getDeclaredMethod("getStrings");
+ t = m.getGenericReturnType();
+ if (!t.toString().equals("java.util.List<java.lang.String>"))
+ throw new RuntimeException("Incorrect signature. Signature is "+t);
+ }
+}
+ \ No newline at end of file
diff --git a/tests/bugs162/pr211146/GenericsLost5.java b/tests/bugs162/pr211146/GenericsLost5.java
new file mode 100644
index 000000000..329bdd735
--- /dev/null
+++ b/tests/bugs162/pr211146/GenericsLost5.java
@@ -0,0 +1,19 @@
+import java.util.*;
+import java.lang.reflect.*;
+
+// generic field itd
+aspect Foo {
+ public List<String> Goo.ls;
+}
+
+class Goo {}
+
+public class GenericsLost5 {
+ public static void main(String[]argv) throws Exception {
+ Field f = Goo.class.getDeclaredField("ls");
+ Type t = f.getGenericType();
+ if (!t.toString().equals("java.util.List<java.lang.String>"))
+ throw new RuntimeException("Incorrect signature. Signature is "+t);
+ }
+}
+ \ No newline at end of file