aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-07-11 13:48:57 +0000
committeracolyer <acolyer>2005-07-11 13:48:57 +0000
commit3be70641af15361548ab3a576d97fceaea1a9557 (patch)
tree4a0d2787b8547c6c7ae03ee8e2b59b8b3611bdb8 /tests
parentebeba53b5bc8c8134ac1bfe119c3154008862cc0 (diff)
downloadaspectj-3be70641af15361548ab3a576d97fceaea1a9557.tar.gz
aspectj-3be70641af15361548ab3a576d97fceaea1a9557.zip
added one simple test for matching members of a parameterized type.
Took me 3 days to get it to pass!!!
Diffstat (limited to 'tests')
-rw-r--r--tests/java5/generics/pointcuts/ConcreteImplementingClass.java9
-rw-r--r--tests/java5/generics/pointcuts/GenericImplementingClass.java8
-rw-r--r--tests/java5/generics/pointcuts/GenericInterface.java5
-rw-r--r--tests/java5/generics/pointcuts/RawTypeMatching.aj17
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java11
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ajc150.xml34
6 files changed, 71 insertions, 13 deletions
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<Double> {
+
+ // 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<N extends Number>
+ implements GenericInterface<N> {
+
+ 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<N extends Number> {
+
+ 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<Long> gic = new GenericImplementingClass<Long>();
+ 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 @@
<compile files="PR94086.aj" options="-1.5"/>
</ajc-test>
- // generic bugs
+ <!-- generic bugs -->
<ajc-test dir="java5/generics/bugs" title="ITD method with generic arg">
<compile files="PR97763.aj" options="-1.5"/>
@@ -2296,9 +2296,9 @@
<run class="pr100260"/>
</ajc-test>
- // end of generic bugs
+ <!-- end of generic bugs -->
- // generic aspects
+ <!-- generic aspects -->
<ajc-test dir="java5/generics/genericaspects" title="generic aspects - 1">
<compile files="GenericAspect1.aj" options="-1.5"/>
@@ -2320,10 +2320,10 @@
</run>
</ajc-test>
- // end of generic aspects
-
- // generic ITDs
+ <!-- end of generic aspects -->
+ <!-- generic ITDs -->
+
<ajc-test dir="java5/generics/itds" title="ITDs on generic type">
<compile files="Parse5.java" options="-1.5">
<message kind="error" line="9"/>
@@ -2387,9 +2387,9 @@
<compile files="Parse4.java" options="-1.5"/>
</ajc-test>
- // end of generic ITDs
+ <!-- end of generic ITDs -->
- // generic decps
+ <!-- generic decps -->
<ajc-test dir="java5/generics/decp" title="generic decp - simple">
<compile files="Basic.aj" options="-1.5"/>
@@ -2401,7 +2401,7 @@
<message kind="error" line="11" text="Cannot declare parent I&lt;java.lang.Integer&gt; onto type Basic2 since it already has I&lt;java.lang.String&gt; in its hierarchy"/>
</compile>
</ajc-test>
-
+
<ajc-test dir="java5/generics/decp" title="generic decp - implementing two variants #2">
<compile files="Basic2b.aj" options="-1.5">
<message kind="error" line="10" text="Cannot declare parent I&lt;java.lang.Integer&gt; onto type Basic2b since it already has I in its hierarchy"/>
@@ -2442,7 +2442,7 @@
<!-- -->
- <ajc-test dir="java5/generics/decp" title="generic decp - incorrect number of type parameters">
+ <ajc-test dir="java5/generics/decp" title="generic decp - incorrect number of type parameters">
<compile files="Basic3.aj" options="-1.5"/>
<run class="Basic3"/>
</ajc-test>
@@ -2460,8 +2460,20 @@
<!--ajc-test dir="java5/generics/decp" title="illegal generic decp">
<compile files="Basic2.aj" options="-1.5"/>
</ajc-test-->
+
+ <!-- end of generic decps -->
+
+ <!-- generics and pointcuts -->
+
+ <ajc-test dir="java5/generics/pointcuts" title="execution pcd with raw type matching">
+ <compile files="GenericInterface.java,ConcreteImplementingClass.java,GenericImplementingClass.java,RawTypeMatching.aj" options="-1.5">
+ <message kind="warning" line="4" text="execution(* GenericInterface.*(..))"/>
+ <message kind="warning" line="5" text="execution(* GenericInterface.*(..))"/>
+ </compile>
+ </ajc-test>
+
+ <!-- end of generics and pointcuts tests -->
- // end of generic decps
<!-- ============================================================== -->
<!-- End of generics tests -->
<!-- ============================================================== -->