diff options
author | acolyer <acolyer> | 2005-08-10 08:39:08 +0000 |
---|---|---|
committer | acolyer <acolyer> | 2005-08-10 08:39:08 +0000 |
commit | 56fdece12db2228299df8f5e3481d8d3eeb2cbac (patch) | |
tree | d2aa91f8a18e58274e0fafff6411a77e8bafa808 /tests/src/org/aspectj | |
parent | cb4c7214369154984d59cec11bfb909be37bf3ac (diff) | |
download | aspectj-56fdece12db2228299df8f5e3481d8d3eeb2cbac.tar.gz aspectj-56fdece12db2228299df8f5e3481d8d3eeb2cbac.zip |
test cases for after throwing and after returning with generic and parameterized types.
Diffstat (limited to 'tests/src/org/aspectj')
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java | 28 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc150/ajc150.xml | 107 |
2 files changed, 134 insertions, 1 deletions
diff --git a/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java b/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java index a16a6f300..99d9c8087 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java +++ b/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java @@ -543,6 +543,34 @@ public class GenericsTests extends XMLBasedAjcTestCase { runTest("generic wildcards in signature matching"); } + public void testAfterThrowing() { + runTest("after throwing with parameterized throw type"); + } + + public void testAfterReturningWithRawType() { + runTest("after returning with raw type and generic / parameterized sigs"); + } + + public void testAfterReturningParameterizedType() { + runTest("after returning with parameterized type and generic / parameterized sigs"); + } + + public void testAfterReturningParameterizedAndWildcards() { + runTest("after returning with parameterized type and wildcards"); + } + + public void testAfterReturningWithWildcardVar() { + runTest("after returning with generic wildcard"); + } + + public void testAfterReturningWithWildcardExtendsVar() { + runTest("after returning with generic wildcard extends"); + } + + public void testAfterReturningWithWildcardSuperVar() { + runTest("after returning with generic wildcard super"); + } + // --- helpers // Check the signature attribute on a class is correct diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml index 1605cccf4..c2faab4f6 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml +++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml @@ -3116,6 +3116,7 @@ <ajc-test dir="java5/generics/pointcuts" title="args with parameterized type and wildcards"> <compile files="ArgsParameterizedWithWildcards.aj" options="-1.5"> + <message kind="warning" line="10" text="unchecked match of List<Double> with List when argument is an instance of List"/> <message kind="warning" line="10" text="unchecked match of List<Double> with List<? extends Double> when argument is an instance of List"/> <message kind="warning" line="10" text="unchecked match of List<Double> with List<? extends Number> when argument is an instance of List"/> <message kind="warning" line="10" text="unchecked match of List<Double> with List<?> when argument is an instance of List"/> @@ -3202,9 +3203,113 @@ </compile> </ajc-test> - <!-- end of generics and pointcuts tests --> + + <ajc-test dir="java5/generics/afterAdvice" title="after throwing with parameterized throw type"> + <compile files="AfterThrowing.aj" options="-1.5"> + <message kind="error" line="6" text="cannot convert from List<String> to Throwable"/> + </compile> + </ajc-test> + + + <ajc-test dir="java5/generics/afterAdvice" title="after returning with raw type and generic / parameterized sigs"> + <compile files="AfterReturningRawType.aj" options="-1.5"> + </compile> + <run class="AfterReturningRawType"> + <stdout> + <line text="returning(List) match at call(List Generic.foo(List))"/> + <line text="returning(List) match at call(List Generic.bar(List))"/> + <line text="returning(List) match at call(List Generic.tada(List))"/> + <line text="returning(List) match at call(List Generic.tada(List))"/> + <line text="returning(List) match at call(List Generic.tada(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/afterAdvice" title="after returning with parameterized type and generic / parameterized sigs"> + <compile files="AfterReturningParameterized.aj" options="-1.5"> + <message kind="warning" line="28" text="unchecked match of List<String> with List"/> + </compile> + <run class="AfterReturningParameterized"> + <stdout> + <line text="returning(List<String> matched at call(List Generic.foo(List))"/> + <line text="returning(List<String> matched at call(List Generic.bar(List))"/> + <line text="returning(List<String> matched at call(List Generic.tada(List))"/> + <line text="returning(List<String> matched at call(List Generic.something(List))"/> + <line text="returning(List<String> matched at call(List MustBeString.listit(List))"/> + </stdout> + </run> + </ajc-test> + <ajc-test dir="java5/generics/afterAdvice" title="after returning with parameterized type and wildcards"> + <compile files="AfterReturningParameterizedWithWildcards.aj" options="-1.5"> + <message kind="warning" line="10" text="unchecked match of List<Double> with List when argument is an instance of List"/> + <message kind="warning" line="10" text="unchecked match of List<Double> with List<? extends Double> when argument is an instance of List"/> + <message kind="warning" line="10" text="unchecked match of List<Double> with List<? extends Number> when argument is an instance of List"/> + <message kind="warning" line="10" text="unchecked match of List<Double> with List<?> when argument is an instance of List"/> + </compile> + <run class="AfterReturningParameterizedWithWildcards"> + <stdout> + <line text="List<Double> matched at call(List C.rawList(List))"/> + <line text="List<Double> matched at call(List C.listOfSomething(List))"/> + <line text="List<Double> matched at call(List C.listOfSomeNumber(List))"/> + <line text="List<Double> matched at call(List C.listOfDouble(List))"/> + <line text="List<Double> matched at call(List C.listOfSomeDouble(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/afterAdvice" title="after returning with generic wildcard"> + <compile files="AfterReturningListOfSomething.aj" options="-1.5"> + </compile> + <run class="AfterReturningListOfSomething"> + <stdout> + <line text="List<?> matches execution(List AfterReturningListOfSomething.rawList(List))"/> + <line text="List<?> matches execution(List AfterReturningListOfSomething.listOfString(List))"/> + <line text="List<?> matches execution(List AfterReturningListOfSomething.listOfSomething(List))"/> + <line text="List<?> matches execution(List AfterReturningListOfSomething.listOfSomethingExtends(List))"/> + <line text="List<?> matches execution(List AfterReturningListOfSomething.listOfSomethingSuper(List))"/> + <line text="wild map matches execution(Map AfterReturningListOfSomething.mapit(Map))"/> + <line text="exact wild map matches execution(Map AfterReturningListOfSomething.mapit(Map))"/> + <line text="super type exact matches execution(HashSet AfterReturningListOfSomething.setOf(HashSet))"/> + <line text="super wild type matches execution(HashSet AfterReturningListOfSomething.setOf(HashSet))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/afterAdvice" title="after returning with generic wildcard extends"> + <compile files="AfterReturningListOfSomethingExtends.aj" options="-1.5"> + <message kind="warning" line="27" text="unchecked match of List<? extends Number> with List"/> + <message kind="warning" line="27" text="unchecked match of List<? extends Number> with List<?>"/> + </compile> + <run class="AfterReturningListOfSomethingExtends"> + <stdout> + <line text="List<? extends Number> matches execution(List AfterReturningListOfSomethingExtends.rawList(List))"/> + <line text="List<? extends Number> matches execution(List AfterReturningListOfSomethingExtends.listOfNumber(List))"/> + <line text="List<? extends Number> matches execution(List AfterReturningListOfSomethingExtends.listOfDouble(List))"/> + <line text="List<? extends Number> matches execution(List AfterReturningListOfSomethingExtends.listOfSomething(List))"/> + <line text="List<? extends Number> matches execution(List AfterReturningListOfSomethingExtends.listOfSomethingExtends(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/afterAdvice" title="after returning with generic wildcard super"> + <compile files="AfterReturningListOfSomethingSuper.aj" options="-1.5"> + <message kind="warning" line="32" text="unchecked match of List<? super Number> with List"/> + <message kind="warning" line="32" text="unchecked match of List<? super Number> with List<?>"/> + <message kind="warning" line="32" text="unchecked match of List<? super Number> with List<? extends Number>"/> + </compile> + <run class="AfterReturningListOfSomethingSuper"> + <stdout> + <line text="List<? super Number> matches execution(List AfterReturningListOfSomethingSuper.rawList(List))"/> + <line text="List<? super Number> matches execution(List AfterReturningListOfSomethingSuper.listOfObject(List))"/> + <line text="List<? super Number> matches execution(List AfterReturningListOfSomethingSuper.listOfNumber(List))"/> + <line text="List<? super Number> matches execution(List AfterReturningListOfSomethingSuper.listOfSomething(List))"/> + <line text="List<? super Number> matches execution(List AfterReturningListOfSomethingSuper.listOfSomethingSuper(List))"/> + <line text="List<? super Number> matches execution(List AfterReturningListOfSomethingSuper.listOfSomethingExtendsNumber(List))"/> + </stdout> + </run> + </ajc-test> <!-- ============================================================== --> <!-- End of generics tests --> <!-- ============================================================== --> |