diff options
author | aclement <aclement> | 2005-07-21 10:01:29 +0000 |
---|---|---|
committer | aclement <aclement> | 2005-07-21 10:01:29 +0000 |
commit | 314bd5f7977ebe80b65a27c2c4df56c7b2e77d24 (patch) | |
tree | 40ae2ab595d68341554da09dd9450eb2d48b3a55 /tests | |
parent | e59d3c8559ab260fff18b12af97cb5de92157c06 (diff) | |
download | aspectj-314bd5f7977ebe80b65a27c2c4df56c7b2e77d24.tar.gz aspectj-314bd5f7977ebe80b65a27c2c4df56c7b2e77d24.zip |
generics: fixes for decp testcases involving generic types targeted by parameterized decps. Type variables now persist in the system for longer... also LazyClassGen generates correct generic signatures for modified types.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/java5/generics/decp/Basic4.aj | 5 | ||||
-rw-r--r-- | tests/java5/generics/decp/Basic5.aj | 5 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java | 18 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc150/ajc150.xml | 26 |
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<T extends Number>"/> + </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<java.lang.Integer>' (Basic6.aj)"/> + </compile> + <run class="Basic6"/> + </ajc-test> + <!-- end of generic decps --> <!-- generics and pointcuts --> |