diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/bugs153/pr161502/Main.java | 34 | ||||
-rw-r--r-- | tests/bugs153/pr161502/Main2.java | 34 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc150/ajc150.xml | 38 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java | 2 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc153/ajc153.xml | 14 |
5 files changed, 112 insertions, 10 deletions
diff --git a/tests/bugs153/pr161502/Main.java b/tests/bugs153/pr161502/Main.java new file mode 100644 index 000000000..81a1eae09 --- /dev/null +++ b/tests/bugs153/pr161502/Main.java @@ -0,0 +1,34 @@ +import java.util.ArrayList; +import java.util.List; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; + +public class Main { + + public List<? extends Element> getElements() { + return new ArrayList<Element>(); + } + + class Element {}; + + @Aspect + static abstract class Base<T> { + @Around("call(List<? extends T> *.*(..))") + public List<? extends T> elementList(ProceedingJoinPoint thisJoinPoint) { + try { + return (List<? extends T>)thisJoinPoint.proceed(); + } catch (Throwable e) { + throw new RuntimeException(e); + } + } + } + + @Aspect + static class Concrete extends Base<Element> {} + + public static void main(String[] args) { + new Main().getElements(); + } + +}
\ No newline at end of file diff --git a/tests/bugs153/pr161502/Main2.java b/tests/bugs153/pr161502/Main2.java new file mode 100644 index 000000000..b87503b28 --- /dev/null +++ b/tests/bugs153/pr161502/Main2.java @@ -0,0 +1,34 @@ +import java.util.ArrayList; +import java.util.List; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; + +public class Main2 { + + public List<? extends Element> getElements() { + return new ArrayList<Element>(); + } + + class Element {}; + + @Aspect + static abstract class Base<T> { + @Around("call(List<? extends T> *.*(..))") + public List<? extends T> elementList(ProceedingJoinPoint thisJoinPoint) { + try { + return (List<? extends T>)thisJoinPoint.proceed(); + } catch (Throwable e) { + throw new RuntimeException(e); + } + } + } + + @Aspect + static class Concrete extends Base<String> {} // pointcut won't match because not a call to "List<? extends String> *(..)" + + public static void main(String[] args) { + new Main2().getElements(); + } + +}
\ No newline at end of file diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml index 503eccbe8..1ca3b4b59 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml +++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml @@ -4563,21 +4563,21 @@ <compile files="GenericAspectY.aj" options="-1.5 -showWeaveInfo"> <message kind="weave" text="Join point 'method-execution(void ParentChildRelationship$ParentHasChildren.addChild(C))' in Type 'ParentChildRelationship' (GenericAspectY.aj:53) advised by before advice from 'GenericAspectY' (GenericAspectY.aj:101) [with runtime test]"/> <message kind="weave" text="Extending interface set for type 'Top' (GenericAspectY.aj) to include 'ParentChildRelationship$ParentHasChildren<Bottom>' (GenericAspectY.aj)"/> - <message kind="weave" text="Type 'Top' (GenericAspectY.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectY.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.children')"/> - <message kind="weave" text="Type 'Top' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.getChildren()')"/> - <message kind="weave" text="Type 'Top' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ParentHasChildren.addChild(C)')"/> - <message kind="weave" text="Type 'Top' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ParentHasChildren.removeChild(C)')"/> + <message kind="weave" text="Type 'Top' (GenericAspectY.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectY.aj:'java.util.List<Bottom> ParentChildRelationship$ParentHasChildren.children')"/> + <message kind="weave" text="Type 'Top' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'java.util.List<Bottom> ParentChildRelationship$ParentHasChildren.getChildren()')"/> + <message kind="weave" text="Type 'Top' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ParentHasChildren.addChild(Bottom)')"/> + <message kind="weave" text="Type 'Top' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ParentHasChildren.removeChild(Bottom)')"/> <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectY.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectY.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.children')"/> <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.getChildren()')"/> <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ParentHasChildren.addChild(C)')"/> <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ParentHasChildren.removeChild(C)')"/> <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectY.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectY.aj:'ParentChildRelationship$ParentHasChildren ParentChildRelationship$ChildHasParent.parent')"/> - <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'ParentChildRelationship$ParentHasChildren ParentChildRelationship$ChildHasParent.getParent()')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'P ParentChildRelationship$ChildHasParent.getParent()')"/> <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ChildHasParent.setParent(P)')"/> <message kind="weave" text="Extending interface set for type 'Bottom' (GenericAspectY.aj) to include 'ParentChildRelationship$ChildHasParent<Top>' (GenericAspectY.aj)"/> - <message kind="weave" text="Type 'Bottom' (GenericAspectY.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectY.aj:'ParentChildRelationship$ParentHasChildren ParentChildRelationship$ChildHasParent.parent')"/> - <message kind="weave" text="Type 'Bottom' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'ParentChildRelationship$ParentHasChildren ParentChildRelationship$ChildHasParent.getParent()')"/> - <message kind="weave" text="Type 'Bottom' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ChildHasParent.setParent(P)')"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectY.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectY.aj:'Top ParentChildRelationship$ChildHasParent.parent')"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'Top ParentChildRelationship$ChildHasParent.getParent()')"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ChildHasParent.setParent(Top)')"/> </compile> <run class="GenericAspectY"/> </ajc-test> @@ -4585,7 +4585,25 @@ <compile files="GenericAspectZ.aj" options="-1.5 -showWeaveInfo"> <message kind="weave" text="Join point 'method-execution(void ParentChildRelationship$ParentHasChildren.addChild(C))' in Type 'ParentChildRelationship' (GenericAspectZ.aj:53) advised by before advice from 'GenericAspectZ' (GenericAspectZ.aj:95) [with runtime test]"/> <message kind="weave" text="Join point 'method-execution(void ParentChildRelationship$ParentHasChildren.removeChild(C))' in Type 'ParentChildRelationship' (GenericAspectZ.aj:65) advised by before advice from 'GenericAspectZ' (GenericAspectZ.aj:96) [with runtime test]"/> + <message kind="weave" text="Extending interface set for type 'Top' (GenericAspectZ.aj) to include 'ParentChildRelationship$ParentHasChildren<Bottom>' (GenericAspectZ.aj)"/> + <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<Bottom> ParentChildRelationship$ParentHasChildren.children')"/> + <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<Bottom> ParentChildRelationship$ParentHasChildren.getChildren()')"/> + <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ParentHasChildren.addChild(Bottom)')"/> + <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ParentHasChildren.removeChild(Bottom)')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.children')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.getChildren()')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ParentHasChildren.addChild(C)')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ParentHasChildren.removeChild(C)')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'ParentChildRelationship$ParentHasChildren ParentChildRelationship$ChildHasParent.parent')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'P ParentChildRelationship$ChildHasParent.getParent()')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ChildHasParent.setParent(P)')"/> + <message kind="weave" text="Extending interface set for type 'Bottom' (GenericAspectZ.aj) to include 'ParentChildRelationship$ChildHasParent<Top>' (GenericAspectZ.aj)"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'Top ParentChildRelationship$ChildHasParent.parent')"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'Top ParentChildRelationship$ChildHasParent.getParent()')"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ChildHasParent.setParent(Top)')"/> + + <!--message kind="weave" text="Extending interface set for type 'Top' (GenericAspectZ.aj) to include 'ParentChildRelationship$ParentHasChildren<Bottom>' (GenericAspectZ.aj)"/> <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.children')"/> <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.getChildren()')"/> <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ParentHasChildren.addChild(C)')"/> @@ -4600,7 +4618,7 @@ <message kind="weave" text="Extending interface set for type 'Bottom' (GenericAspectZ.aj) to include 'ParentChildRelationship$ChildHasParent<Top>' (GenericAspectZ.aj)"/> <message kind="weave" text="Type 'Bottom' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'ParentChildRelationship$ParentHasChildren ParentChildRelationship$ChildHasParent.parent')"/> <message kind="weave" text="Type 'Bottom' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'ParentChildRelationship$ParentHasChildren ParentChildRelationship$ChildHasParent.getParent()')"/> - <message kind="weave" text="Type 'Bottom' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ChildHasParent.setParent(P)')"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ChildHasParent.setParent(P)')"/--> </compile> <run class="GenericAspectZ"/> </ajc-test> @@ -4781,7 +4799,7 @@ <compile files="A2.aj" inpath="code.jar" options="-1.5,-showWeaveInfo"> <message kind="weave" text="Type 'BaseClass' (BaseClass.java) has intertyped field from 'A1' (A1.aj:'java.util.List<java.lang.String> BaseClass.list1')"/> <message kind="weave" text="Type 'BaseClass' (BaseClass.java:12) advised by after advice from 'A1' (A1.aj:7)"/> - <message kind="weave" text="Type 'BaseClass' (BaseClass.java) has intertyped field from 'A2' (A2.aj:'java.util.List<Z> BaseClass.list2')"/> + <message kind="weave" text="Type 'BaseClass' (BaseClass.java) has intertyped field from 'A2' (A2.aj:'java.util.List<N> BaseClass.list2')"/> <message kind="weave" text="Type 'BaseClass' (BaseClass.java:13) advised by after advice from 'A2' (A2.aj:8)"/> </compile> <run class="BaseClass"> diff --git a/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java b/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java index e642b4c60..3790fcad6 100644 --- a/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java @@ -28,6 +28,8 @@ public class Ajc153Tests extends org.aspectj.testing.XMLBasedAjcTestCase { // public void testCFlowXMLAspectLTW_pr149096() { runTest("cflow xml concrete aspect"); } // public void testAmbiguousBinding_pr121805() { runTest("ambiguous binding");} // public void testNegatedAnnotationMatchingProblem_pr153464() { runTest("negated annotation matching problem");} + public void testGenericsInPointcuts_pr161502() { runTest("generics in pointcuts");} + public void testGenericsInPointcuts_pr161502_2() { runTest("generics in pointcuts - 2");} public void testNoNPEDueToMissingType_pr149908() { runTest("ensure no npe due to missing type");} public void testNoNPEDueToMember_pr149908() { runTest("ensure no npe due to missing member");} public void testPTWgetWithinTypeName_pr123423_1() { runTest("basic usage of getWithinTypeName");} diff --git a/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml b/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml index edf0868e6..ee379452d 100644 --- a/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml +++ b/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml @@ -39,6 +39,20 @@ <compile files="BadInterface.java" options="-emacssym"/> </ajc-test> + <ajc-test dir="bugs153/pr161502" title="generics in pointcuts"> + <compile files="Main.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-call(java.util.List Main.getElements())' in Type 'Main' (Main.java:31) advised by around advice from 'Main$Concrete' (Main.java:18)"/> + </compile> + <run class="Main"/> + </ajc-test> + + <ajc-test dir="bugs153/pr161502" title="generics in pointcuts - 2"> + <compile files="Main2.java" options="-1.5 -showWeaveInfo"> + <message kind="warning" text="advice defined in Main2$Base has not been applied"/> + </compile> + <run class="Main2"/> + </ajc-test> + <ajc-test dir="bugs153/pr158624" title="generics and arrays"> <compile files="ValueChange.java" options="-1.5"/> </ajc-test> |