diff options
author | aclement <aclement> | 2011-02-10 22:52:59 +0000 |
---|---|---|
committer | aclement <aclement> | 2011-02-10 22:52:59 +0000 |
commit | 01be71f629baedd6cc0018b8b4305093c6c91c8a (patch) | |
tree | 75426877ad30d99e50eac423e11aba25068c9f10 | |
parent | 1083a1d359be9ac539de0b0d18414598c80c8c92 (diff) | |
download | aspectj-01be71f629baedd6cc0018b8b4305093c6c91c8a.tar.gz aspectj-01be71f629baedd6cc0018b8b4305093c6c91c8a.zip |
PR336880 PR336774 PR336745
-rw-r--r-- | tests/bugs1611/pr336745/Foo.aj | 10 | ||||
-rw-r--r-- | tests/bugs1611/pr336774/First.java | 7 | ||||
-rw-r--r-- | tests/bugs1611/pr336774/One.java | 7 | ||||
-rw-r--r-- | tests/bugs1611/pr336774/Test.java | 5 | ||||
-rw-r--r-- | tests/bugs1611/pr336774/Two.java | 5 | ||||
-rw-r--r-- | tests/bugs1611/pr336880/First.java | 11 | ||||
-rw-r--r-- | tests/bugs1611/pr336880/Second.java | 13 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc1611/Ajc1611Tests.java | 34 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc1611/ajc1611.xml | 14 |
9 files changed, 106 insertions, 0 deletions
diff --git a/tests/bugs1611/pr336745/Foo.aj b/tests/bugs1611/pr336745/Foo.aj new file mode 100644 index 000000000..7191fd09a --- /dev/null +++ b/tests/bugs1611/pr336745/Foo.aj @@ -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 index 000000000..8e6b9c464 --- /dev/null +++ b/tests/bugs1611/pr336774/First.java @@ -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 index 000000000..095a51078 --- /dev/null +++ b/tests/bugs1611/pr336774/One.java @@ -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 index 000000000..9b2e16eba --- /dev/null +++ b/tests/bugs1611/pr336774/Test.java @@ -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 index 000000000..01ce9ec12 --- /dev/null +++ b/tests/bugs1611/pr336774/Two.java @@ -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 index 000000000..ad46da0c6 --- /dev/null +++ b/tests/bugs1611/pr336880/First.java @@ -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 index 000000000..257f169b2 --- /dev/null +++ b/tests/bugs1611/pr336880/Second.java @@ -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 {} diff --git a/tests/src/org/aspectj/systemtest/ajc1611/Ajc1611Tests.java b/tests/src/org/aspectj/systemtest/ajc1611/Ajc1611Tests.java index 5c8149090..c55eb47ef 100644 --- a/tests/src/org/aspectj/systemtest/ajc1611/Ajc1611Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc1611/Ajc1611Tests.java @@ -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"); } diff --git a/tests/src/org/aspectj/systemtest/ajc1611/ajc1611.xml b/tests/src/org/aspectj/systemtest/ajc1611/ajc1611.xml index c5c51012b..db5fd041c 100644 --- a/tests/src/org/aspectj/systemtest/ajc1611/ajc1611.xml +++ b/tests/src/org/aspectj/systemtest/ajc1611/ajc1611.xml @@ -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"> |