summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/java5/generics/decp/Basic4.aj5
-rw-r--r--tests/java5/generics/decp/Basic5.aj5
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java18
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ajc150.xml26
4 files changed, 35 insertions, 19 deletions
diff --git a/tests/java5/generics/decp/Basic4.aj b/tests/java5/generics/decp/Basic4.aj
index 10ccc56a7..6d88ffc76 100644
--- a/tests/java5/generics/decp/Basic4.aj
+++ b/tests/java5/generics/decp/Basic4.aj
@@ -2,6 +2,11 @@
interface I<T extends Number> { }
public class Basic4 {
+ public static void main(String[] argv) {
+ Basic4 b4 = new Basic4();
+ if (!(b4 instanceof I))
+ throw new RuntimeException("Should be instanceof I!");
+ }
}
aspect X {
diff --git a/tests/java5/generics/decp/Basic5.aj b/tests/java5/generics/decp/Basic5.aj
index 991eda6c2..6fb3d80ec 100644
--- a/tests/java5/generics/decp/Basic5.aj
+++ b/tests/java5/generics/decp/Basic5.aj
@@ -1,9 +1,8 @@
-// fails, Number is not a subclass of double!
-interface I<T super Number> { }
+interface I<T extends Number> { }
public class Basic5 {
}
aspect X {
- declare parents: Basic5 implements I<Double>;
+ declare parents: Basic5 implements I<String>;
}
diff --git a/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java b/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java
index 6f794910b..24b027b7e 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java
@@ -178,7 +178,7 @@ public class GenericsTests extends XMLBasedAjcTestCase {
public void testPR96220_GenericDecp() {
runTest("generic decp - simple");
- verifyClassSignature("Basic","Ljava/lang/Object;PJ<Ljava/lang/Double;>;PI<Ljava/lang/Double;>;");
+ verifyClassSignature("Basic","Ljava/lang/Object;LJ<Ljava/lang/Double;>;LI<Ljava/lang/Double;>;");
}
// Both the existing type decl and the one adding via decp are parameterized
@@ -219,16 +219,20 @@ public class GenericsTests extends XMLBasedAjcTestCase {
public void testGenericDecpMultipleVariantsOfAParameterizedType4_binaryWeaving() {
runTest("generic decp binary - implementing two variants #4");
}
+
+ public void testGenericDecpParameterized() {
+ runTest("generic decp - with parameterized on the target");
+ verifyClassSignature("Basic6","<J:Ljava/lang/Object;>Ljava/lang/Object;LI<TJ;>;LK<Ljava/lang/Integer;>;");
+ }
-//
// public void testGenericDecpIncorrectNumberOfTypeParams() {
// runTest("generic decp - incorrect number of type parameters");
// }
-//
-// public void testGenericDecpSpecifyingBounds() {
-// runTest("generic decp - specifying bounds");
-// }
-//
+
+ public void testGenericDecpSpecifyingBounds() {
+ runTest("generic decp - specifying bounds");
+ }
+
// public void testGenericDecpViolatingBounds() {
// runTest("generic decp - specifying bounds but breaking them");
// }
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
index 07345574d..109c05a0f 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
+++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
@@ -2445,13 +2445,17 @@
<ajc-test dir="java5/generics/decp/binary" title="generic decp binary - implementing two variants #4">
<weave classesFiles="Base4.java" aspectsFiles="Asp4.aj" options="-1.5,-showWeaveInfo"/>
</ajc-test>
-
-<!-- -->
- <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>
+
+ <ajc-test dir="java5/generics/decp" title="generic decp - incorrect number of type parameters">
+ <compile files="Basic3.aj" options="-1.5">
+ <message kind="error" line="10" text="Wrong number of type arguments; Type I requires 1"/>
+ </compile>
+ </ajc-test>
<ajc-test dir="java5/generics/decp" title="generic decp - specifying bounds">
<compile files="Basic4.aj" options="-1.5"/>
@@ -2459,14 +2463,18 @@
</ajc-test>
<ajc-test dir="java5/generics/decp" title="generic decp - specifying bounds but breaking them">
- <compile files="Basic5.aj" options="-1.5"/>
- <run class="Basic5"/>
+ <compile files="Basic5.aj" options="-1.5">
+ <message kind="error" line="7" text="Type String does not meet the specification for type parameter 1 in generic type I&lt;T extends Number&gt;"/>
+ </compile>
</ajc-test>
-
- <!--ajc-test dir="java5/generics/decp" title="illegal generic decp">
- <compile files="Basic2.aj" options="-1.5"/>
- </ajc-test-->
+ <ajc-test dir="java5/generics/decp" title="generic decp - with parameterized on the target">
+ <compile files="Basic6.aj" options="-1.5,-showWeaveInfo">
+ <message kind="weave" text="Extending interface set for type 'Basic6' (Basic6.aj) to include 'K&lt;java.lang.Integer&gt;' (Basic6.aj)"/>
+ </compile>
+ <run class="Basic6"/>
+ </ajc-test>
+
<!-- end of generic decps -->
<!-- generics and pointcuts -->