From 01be71f629baedd6cc0018b8b4305093c6c91c8a Mon Sep 17 00:00:00 2001 From: aclement Date: Thu, 10 Feb 2011 22:52:59 +0000 Subject: [PATCH] PR336880 PR336774 PR336745 --- tests/bugs1611/pr336745/Foo.aj | 10 ++++++ tests/bugs1611/pr336774/First.java | 7 ++++ tests/bugs1611/pr336774/One.java | 7 ++++ tests/bugs1611/pr336774/Test.java | 5 +++ tests/bugs1611/pr336774/Two.java | 5 +++ tests/bugs1611/pr336880/First.java | 11 ++++++ tests/bugs1611/pr336880/Second.java | 13 +++++++ .../systemtest/ajc1611/Ajc1611Tests.java | 34 +++++++++++++++++++ .../aspectj/systemtest/ajc1611/ajc1611.xml | 14 ++++++++ 9 files changed, 106 insertions(+) create mode 100644 tests/bugs1611/pr336745/Foo.aj create mode 100644 tests/bugs1611/pr336774/First.java create mode 100644 tests/bugs1611/pr336774/One.java create mode 100644 tests/bugs1611/pr336774/Test.java create mode 100644 tests/bugs1611/pr336774/Two.java create mode 100644 tests/bugs1611/pr336880/First.java create mode 100644 tests/bugs1611/pr336880/Second.java 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 void C.mitd(T something) {} +} + +class C { + 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 projectTo(Class cts); +} + +aspect X { + public T NodeBacked.projectTo(Class 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 YYY II.foo(XXX r, Class 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) of type II is not applicable for the arguments (E1, + // Class). The inferred type capture#1-of ? extends E2 is not a valid substitute for the bounded + // parameter + 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("(TT;)V", m.getGenericSignature()); + assertEquals("(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 @@ + + + + + + + + + + + + + + -- 2.39.5