From 3fb03ca8295926e82a14dfff3319bd7dd497a881 Mon Sep 17 00:00:00 2001
From: aclement <aclement>
Date: Mon, 29 Oct 2007 16:03:10 +0000
Subject: 203646: tests and fixes for ITD method on generic inner type

---
 tests/bugs154/pr203646/Bang.java     |  9 +++++++++
 tests/bugs154/pr203646/ExampleA.java | 22 ++++++++++++++++++++++
 tests/bugs154/pr203646/ExampleB.java | 22 ++++++++++++++++++++++
 tests/bugs154/pr203646/ExampleC.java | 26 ++++++++++++++++++++++++++
 tests/bugs154/pr203646/ExampleD.java | 26 ++++++++++++++++++++++++++
 tests/bugs154/pr203646/ExampleE.java | 23 +++++++++++++++++++++++
 tests/bugs154/pr203646/ExampleF.java | 25 +++++++++++++++++++++++++
 tests/bugs154/pr203646/ExampleG.java | 10 ++++++++++
 8 files changed, 163 insertions(+)
 create mode 100644 tests/bugs154/pr203646/Bang.java
 create mode 100644 tests/bugs154/pr203646/ExampleA.java
 create mode 100644 tests/bugs154/pr203646/ExampleB.java
 create mode 100644 tests/bugs154/pr203646/ExampleC.java
 create mode 100644 tests/bugs154/pr203646/ExampleD.java
 create mode 100644 tests/bugs154/pr203646/ExampleE.java
 create mode 100644 tests/bugs154/pr203646/ExampleF.java
 create mode 100644 tests/bugs154/pr203646/ExampleG.java

(limited to 'tests/bugs154')

diff --git a/tests/bugs154/pr203646/Bang.java b/tests/bugs154/pr203646/Bang.java
new file mode 100644
index 000000000..0b7ba7445
--- /dev/null
+++ b/tests/bugs154/pr203646/Bang.java
@@ -0,0 +1,9 @@
+// fails
+
+interface I {
+  interface J< T > {}
+}
+
+public aspect Bang {
+ public void I.J< T >.intro() {}
+}
\ No newline at end of file
diff --git a/tests/bugs154/pr203646/ExampleA.java b/tests/bugs154/pr203646/ExampleA.java
new file mode 100644
index 000000000..b1ceced01
--- /dev/null
+++ b/tests/bugs154/pr203646/ExampleA.java
@@ -0,0 +1,22 @@
+// ITD of a method onto a generic inner type - working example
+
+interface I {
+  interface J< T > {}
+}
+
+aspect Bang {
+ public int I.J<T>.intro(T t) {return 42;}
+}
+
+class Impl implements I {
+  class InnerImpl implements J<String> {
+  }
+}
+
+public class ExampleA {
+  public static void main(String []argv) {
+    Impl i = new Impl();
+    Impl.InnerImpl j = i.new InnerImpl();
+    System.out.println(j.intro("foo"));
+  }
+}
\ No newline at end of file
diff --git a/tests/bugs154/pr203646/ExampleB.java b/tests/bugs154/pr203646/ExampleB.java
new file mode 100644
index 000000000..e3047b559
--- /dev/null
+++ b/tests/bugs154/pr203646/ExampleB.java
@@ -0,0 +1,22 @@
+// ITD of a method onto a generic inner type - failing example, passes wrongly typed parameter on the call
+
+interface I {
+  interface J< T > {}
+}
+
+aspect Bang {
+ public int I.J<T>.intro(T t) {return 42;}
+}
+
+class Impl implements I {
+  class InnerImpl implements J<String> {
+  }
+}
+
+public class ExampleB {
+  public static void main(String []argv) {
+    Impl i = new Impl();
+    Impl.InnerImpl j = i.new InnerImpl();
+    System.out.println(j.intro(8));
+  }
+}
\ No newline at end of file
diff --git a/tests/bugs154/pr203646/ExampleC.java b/tests/bugs154/pr203646/ExampleC.java
new file mode 100644
index 000000000..a42ac4eb7
--- /dev/null
+++ b/tests/bugs154/pr203646/ExampleC.java
@@ -0,0 +1,26 @@
+// ITD of a method onto a generic inner inner type
+
+interface I {
+  interface J {
+	  interface K<T> {}
+  }
+}
+
+aspect Bang {
+ public int I.J.K<T>.intro(T t) {return 42;}
+}
+
+class Impl implements I {
+  class InnerImpl implements J {
+	  class InnerInnerImpl implements K<String> {}
+  }
+}
+
+public class ExampleC {
+  public static void main(String []argv) {
+    Impl i = new Impl();
+    Impl.InnerImpl j = i.new InnerImpl();
+    Impl.InnerImpl.InnerInnerImpl k = j.new InnerInnerImpl();
+    System.out.println(k.intro("foo"));
+  }
+}
\ No newline at end of file
diff --git a/tests/bugs154/pr203646/ExampleD.java b/tests/bugs154/pr203646/ExampleD.java
new file mode 100644
index 000000000..f91cff76c
--- /dev/null
+++ b/tests/bugs154/pr203646/ExampleD.java
@@ -0,0 +1,26 @@
+// ITD of a method onto a generic inner type - working example
+
+interface I {
+  interface J<T> {
+	  interface K {}
+  }
+}
+
+aspect Bang {
+ public int I.J<P>.intro(P t) {return 42;}
+}
+
+class Impl implements I {
+  class InnerImpl implements J<String> {
+	  class InnerInnerImpl implements K {}
+  }
+}
+
+public class ExampleD {
+  public static void main(String []argv) {
+    Impl i = new Impl();
+    Impl.InnerImpl j = i.new InnerImpl();
+    Impl.InnerImpl.InnerInnerImpl k = j.new InnerInnerImpl();
+    System.out.println(j.intro("foo"));
+  }
+}
\ No newline at end of file
diff --git a/tests/bugs154/pr203646/ExampleE.java b/tests/bugs154/pr203646/ExampleE.java
new file mode 100644
index 000000000..75de4151d
--- /dev/null
+++ b/tests/bugs154/pr203646/ExampleE.java
@@ -0,0 +1,23 @@
+// ITD of a method onto a generic inner type - complex example
+
+interface I<P> {
+  interface J<Q> {
+  }
+}
+
+aspect Bang {
+ public int I<A>.J<B>.intro(A a,B b) {return 42;}
+}
+
+class Impl implements I<Integer> {
+  class InnerImpl implements J<String> {
+  }
+}
+
+public class ExampleE {
+  public static void main(String []argv) {
+    Impl i = new Impl();
+    Impl.InnerImpl j = i.new InnerImpl();
+    System.out.println(j.intro(new Integer(5),"foo"));
+  }
+}
\ No newline at end of file
diff --git a/tests/bugs154/pr203646/ExampleF.java b/tests/bugs154/pr203646/ExampleF.java
new file mode 100644
index 000000000..9c7e16f46
--- /dev/null
+++ b/tests/bugs154/pr203646/ExampleF.java
@@ -0,0 +1,25 @@
+// ITD of a method onto a generic inner type - complex example
+
+class Goo {}
+
+interface I {
+  interface J<Q extends Goo> {
+  }
+}
+
+aspect Bang {
+ public int I.J.intro(String a,Integer b) {return 42;}
+}
+
+class Impl implements I {
+	class InnerImpl implements J {
+	}
+}
+
+public class ExampleF {
+  public static void main(String []argv) {
+    Impl i = new Impl();
+    Impl.InnerImpl j = i.new InnerImpl();
+    System.out.println(j.intro("o",new Integer(3)));
+  }
+}
\ No newline at end of file
diff --git a/tests/bugs154/pr203646/ExampleG.java b/tests/bugs154/pr203646/ExampleG.java
new file mode 100644
index 000000000..7063ea95a
--- /dev/null
+++ b/tests/bugs154/pr203646/ExampleG.java
@@ -0,0 +1,10 @@
+interface I {
+        interface J< T > {
+                T getT();
+        }
+}
+public aspect ExampleG {
+        public T I.J< T >.intro() {
+                return null;
+        }
+}
\ No newline at end of file
-- 
cgit v1.2.3