From: acolyer Date: Mon, 11 Jul 2005 13:48:57 +0000 (+0000) Subject: added one simple test for matching members of a parameterized type. X-Git-Tag: PRE_ANDY~29 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3be70641af15361548ab3a576d97fceaea1a9557;p=aspectj.git added one simple test for matching members of a parameterized type. Took me 3 days to get it to pass!!! --- diff --git a/tests/java5/generics/pointcuts/ConcreteImplementingClass.java b/tests/java5/generics/pointcuts/ConcreteImplementingClass.java new file mode 100644 index 000000000..b0446cf51 --- /dev/null +++ b/tests/java5/generics/pointcuts/ConcreteImplementingClass.java @@ -0,0 +1,9 @@ +public class ConcreteImplementingClass +implements GenericInterface { + + // make sure this method starts on line 5... + public int asInt(Double d) { + return d.intValue(); + } + +} \ No newline at end of file diff --git a/tests/java5/generics/pointcuts/GenericImplementingClass.java b/tests/java5/generics/pointcuts/GenericImplementingClass.java new file mode 100644 index 000000000..89b8d7870 --- /dev/null +++ b/tests/java5/generics/pointcuts/GenericImplementingClass.java @@ -0,0 +1,8 @@ +public class GenericImplementingClass + implements GenericInterface { + + public int asInt(N aNumber) { + return aNumber.intValue(); + } + + } \ No newline at end of file diff --git a/tests/java5/generics/pointcuts/GenericInterface.java b/tests/java5/generics/pointcuts/GenericInterface.java new file mode 100644 index 000000000..10923121f --- /dev/null +++ b/tests/java5/generics/pointcuts/GenericInterface.java @@ -0,0 +1,5 @@ +public interface GenericInterface { + + int asInt(N aNumber); + +} diff --git a/tests/java5/generics/pointcuts/RawTypeMatching.aj b/tests/java5/generics/pointcuts/RawTypeMatching.aj new file mode 100644 index 000000000..32e80a2ff --- /dev/null +++ b/tests/java5/generics/pointcuts/RawTypeMatching.aj @@ -0,0 +1,17 @@ +public aspect RawTypeMatching { + + // tests that references to a generic or parameterized type are + // always matched by a type pattern refering to the raw type form + + void someCode() { + ConcreteImplementingClass cic = new ConcreteImplementingClass(); + cic.asInt(5.0d); + GenericImplementingClass gic = new GenericImplementingClass(); + gic.asInt(55L); + } + + declare warning : + execution(* GenericInterface.*(..)) : + "execution(* GenericInterface.*(..))"; + +} \ No newline at end of file diff --git a/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java b/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java index d148b9850..fffb6c9b4 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java +++ b/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java @@ -177,9 +177,15 @@ public class GenericsTests extends XMLBasedAjcTestCase { // 1. public ITDs and separate compilation - are the signatures correct for the new public members? // 2. ITDF + + // -- Pointcut tests... - // --- helpers + public void testExecutionWithRawType() { + runTest("execution pcd with raw type matching"); + } + // --- helpers + // Check the signature attribute on a class is correct private void verifyClassSignature(String classname,String sig) { try { @@ -200,5 +206,6 @@ public class GenericsTests extends XMLBasedAjcTestCase { fail("Couldn't find class "+classname+" in the sandbox directory."); } } - + + } diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml index bc11dfeb4..fe5f9f564 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml +++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml @@ -2260,7 +2260,7 @@ - // generic bugs + @@ -2296,9 +2296,9 @@ - // end of generic bugs + - // generic aspects + @@ -2320,10 +2320,10 @@ - // end of generic aspects - - // generic ITDs + + + @@ -2387,9 +2387,9 @@ - // end of generic ITDs + - // generic decps + @@ -2401,7 +2401,7 @@ - + @@ -2442,7 +2442,7 @@ - + @@ -2460,8 +2460,20 @@ + + + + + + + + + + + + + - // end of generic decps