]> source.dussan.org Git - aspectj.git/commitdiff
PR336880 PR336774 PR336745
authoraclement <aclement>
Thu, 10 Feb 2011 22:52:59 +0000 (22:52 +0000)
committeraclement <aclement>
Thu, 10 Feb 2011 22:52:59 +0000 (22:52 +0000)
tests/bugs1611/pr336745/Foo.aj [new file with mode: 0644]
tests/bugs1611/pr336774/First.java [new file with mode: 0644]
tests/bugs1611/pr336774/One.java [new file with mode: 0644]
tests/bugs1611/pr336774/Test.java [new file with mode: 0644]
tests/bugs1611/pr336774/Two.java [new file with mode: 0644]
tests/bugs1611/pr336880/First.java [new file with mode: 0644]
tests/bugs1611/pr336880/Second.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc1611/Ajc1611Tests.java
tests/src/org/aspectj/systemtest/ajc1611/ajc1611.xml

diff --git a/tests/bugs1611/pr336745/Foo.aj b/tests/bugs1611/pr336745/Foo.aj
new file mode 100644 (file)
index 0000000..7191fd0
--- /dev/null
@@ -0,0 +1,10 @@
+aspect Foo {
+ public <T extends I> void C.mitd(T something) {}
+}
+
+class C {
+  <T extends I> void m(T something) {}
+}
+
+interface I {}
+
diff --git a/tests/bugs1611/pr336774/First.java b/tests/bugs1611/pr336774/First.java
new file mode 100644 (file)
index 0000000..8e6b9c4
--- /dev/null
@@ -0,0 +1,7 @@
+interface NodeBacked {
+//  <T extends NodeBacked> T projectTo(Class<T> cts);
+}
+
+aspect X {
+  public <T extends NodeBacked> T NodeBacked.projectTo(Class<T> cts) {return null;}
+}
diff --git a/tests/bugs1611/pr336774/One.java b/tests/bugs1611/pr336774/One.java
new file mode 100644 (file)
index 0000000..095a510
--- /dev/null
@@ -0,0 +1,7 @@
+interface NodeBacked2 {
+  Object projectTo(Class cts);
+}
+
+aspect X {
+  public Object NodeBacked2.projectTo(Class cts) {return null;}
+}
diff --git a/tests/bugs1611/pr336774/Test.java b/tests/bugs1611/pr336774/Test.java
new file mode 100644 (file)
index 0000000..9b2e16e
--- /dev/null
@@ -0,0 +1,5 @@
+class Test implements NodeBacked {
+  public void test() {
+    projectTo(null);
+  }
+}
diff --git a/tests/bugs1611/pr336774/Two.java b/tests/bugs1611/pr336774/Two.java
new file mode 100644 (file)
index 0000000..01ce9ec
--- /dev/null
@@ -0,0 +1,5 @@
+class Two implements NodeBacked2 {
+  public void test() {
+    projectTo(null);
+  }
+}
diff --git a/tests/bugs1611/pr336880/First.java b/tests/bugs1611/pr336880/First.java
new file mode 100644 (file)
index 0000000..ad46da0
--- /dev/null
@@ -0,0 +1,11 @@
+interface II {}
+
+
+aspect X {
+  public <XXX extends I1, YYY extends I2> YYY II.foo(XXX r, Class<YYY> ct) {
+return null;
+  }
+}
+
+interface I1 {}
+interface I2 {}
diff --git a/tests/bugs1611/pr336880/Second.java b/tests/bugs1611/pr336880/Second.java
new file mode 100644 (file)
index 0000000..257f169
--- /dev/null
@@ -0,0 +1,13 @@
+class C implements II {}
+
+class D {
+  public static void m() {
+    C c = new C();
+    E1 e1 = new E1();
+    E2 e2 = new E2();
+    c.foo(e1,e2.getClass());
+  }
+}
+
+class E1 implements I1 {}
+class E2 implements I2 {}
index 5c8149090d94564969098533f7bf748ad9ec23f1..c55eb47efdb744684940ca0fea3dad5ace7fe84c 100644 (file)
@@ -14,6 +14,9 @@ import java.io.File;
 
 import junit.framework.Test;
 
+import org.aspectj.apache.bcel.classfile.JavaClass;
+import org.aspectj.apache.bcel.classfile.Method;
+import org.aspectj.systemtest.ajc150.GenericsTests;
 import org.aspectj.testing.XMLBasedAjcTestCase;
 
 /**
@@ -21,6 +24,37 @@ import org.aspectj.testing.XMLBasedAjcTestCase;
  */
 public class Ajc1611Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
 
+       // error without the fix:
+       // Second.java:8:0::0 Bound mismatch: The generic method foo(R, Class<T>) of type II is not applicable for the arguments (E1,
+       // Class<capture#1-of ? extends E2>). The inferred type capture#1-of ? extends E2 is not a valid substitute for the bounded
+       // parameter <R extends I1>
+       public void testBoundsChecking_pr336880() {
+               runTest("bounds check confusion");
+       }
+
+       public void testClashingItds_pr336774() {
+               runTest("clashing itds");
+       }
+
+       public void testBadGenericSigAttribute_pr336745() {
+               runTest("incorrect signature");
+               JavaClass jc = GenericsTests.getClass(ajc, "C");
+               assertNotNull(jc);
+               Method m = getMethod(jc, "m");
+               Method mitd = getMethod(jc, "mitd");
+               assertEquals("<T::LI;>(TT;)V", m.getGenericSignature());
+               assertEquals("<T::LI;>(TT;)V", mitd.getGenericSignature());
+       }
+
+       private Method getMethod(JavaClass jc, String name) {
+               for (Method m : jc.getMethods()) {
+                       if (m.getName().equals(name)) {
+                               return m;
+                       }
+               }
+               return null;
+       }
+
        public void testESJP_336471() {
                runTest("esjp");
        }
index c5c51012b43535a5f989ffc40aa3c88d4f88426d..db5fd041cf52dcea21266ca7b5d370a069d6a46a 100644 (file)
@@ -2,6 +2,20 @@
 
 <suite>
 
+  <ajc-test dir="bugs1611/pr336880" title="bounds check confusion">
+       <compile files="First.java" options="-1.5"/>
+       <compile files="Second.java" aspectpath="." options="-1.5"/>
+  </ajc-test>
+  
+  <ajc-test dir="bugs1611/pr336774" title="clashing itds">
+       <compile files="First.java" options="-1.5"/>
+       <compile files="Test.java" aspectpath="." options="-1.5"/>
+  </ajc-test>
+  
+  <ajc-test dir="bugs1611/pr336745" title="incorrect signature">
+       <compile files="Foo.aj" options="-1.5"/>
+  </ajc-test>
+  
   <ajc-test dir="bugs1611/pr336471" title="esjp">
        <compile files="Tester.aj" options="-1.5 -Xset:targetRuntime1_6_10=true"/>
        <run class="Tester">