aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/bugs165/pr272233/Iffy2.java76
-rw-r--r--tests/src/test/resources/org/aspectj/systemtest/ajc165/ajc165.xml26
2 files changed, 62 insertions, 40 deletions
diff --git a/tests/bugs165/pr272233/Iffy2.java b/tests/bugs165/pr272233/Iffy2.java
index 2245f7d8d..8c514bdaa 100644
--- a/tests/bugs165/pr272233/Iffy2.java
+++ b/tests/bugs165/pr272233/Iffy2.java
@@ -1,50 +1,60 @@
import java.util.*;
+
import org.aspectj.lang.annotation.*;
@Aspect
class Iffy2 {
+ // Match getCollectionArray(), getIntegerCollectionArray()
@Before("execution(!void *(..))")
- public void advice1() {}
+ public void nonVoid() { }
- @Before("execution(!void[] *(..))")
- public void advice2() {}
+ // Do not match anything, because void[] is an illegal type
+ @Before("execution(void[] *(..))")
+ public void voidArray() {
+ // This does not compile in Java
+ // void[] voids = new void[5];
+ }
- @Before("execution(!void *(..))")
- public void advice3() {}
+ // Match getCollectionArray() and myVoid(), getIntegerCollectionArray(), because void[] is an illegal type which
+ // cannot be resolved/matched. The negation of an unmatched type, however, matches any type, similar to how
+ // !my.UnknownType would also match all other types.
+ @Before("execution(!void[][] *(..))")
+ public void nonVoidArray() { }
+ // Match getCollectionArray(), getIntegerCollectionArray()
@Before("execution(*..Collection[] *(..))")
- public void advice4() {}
+ public void wildcardRawCollectionArray() { }
+ // Match getCollectionArray()
@Before("execution(java.util.Collection<?>[] *(..))")
- public void advice5() {}
-
- /**
- * TODO: This pointcut is not parsed correctly. Obviously, the combination of
- * '*' and '&lt;?&gt;' leads to an AJ core dump with this error message:
- * <p>
- * <code>
- * org.aspectj.weaver.BCException: malformed org.aspectj.weaver.PointcutDeclaration attribute (length:219)
- * org.aspectj.weaver.BCException: Bad type signature *
- * at org.aspectj.weaver.AjAttribute.read(AjAttribute.java:137)
- * at org.aspectj.weaver.bcel.Utility.readAjAttributes(Utility.java:102)
- * at org.aspectj.weaver.bcel.BcelMethod.unpackAjAttributes(BcelMethod.java:197)
- * at org.aspectj.weaver.bcel.BcelMethod.&lt;init&gt;(BcelMethod.java:91)
- * at org.aspectj.weaver.bcel.BcelObjectType.getDeclaredMethods(BcelObjectType.java:290)
- * at org.aspectj.weaver.ReferenceType.getDeclaredMethods(ReferenceType.java:870)
- * at org.aspectj.weaver.ResolvedType.getDeclaredAdvice(ResolvedType.java:1028)
- * at org.aspectj.weaver.ResolvedType.getDeclaredShadowMungers(ResolvedType.java:1068)
- * at org.aspectj.weaver.ResolvedType.collectShadowMungers(ResolvedType.java:868)
- * at org.aspectj.weaver.ResolvedType.collectCrosscuttingMembers(ResolvedType.java:794)
- * at org.aspectj.weaver.CrosscuttingMembersSet.addOrReplaceAspect(CrosscuttingMembersSet.java:112)
- * at org.aspectj.weaver.CrosscuttingMembersSet.addOrReplaceAspect(CrosscuttingMembersSet.java:67)
- * at org.aspectj.weaver.bcel.BcelWeaver.prepareForWeave(BcelWeaver.java:512)
- * </code>
- */
- //@Before("execution(*..Collection<?>[] *(..))")
- public void advice6() {}
+ public void exactGenericCollectionArray() { }
+
+ // Match getCollectionArray()
+ @Before("execution(*..Collection<?>[] *(..))")
+ public void wildcardGenericCollectionArray() { }
+
+ // Do not match anything
+ @Before("execution(*..Collection<String>[] *(..))")
+ public void wildcardGenericCollectionArrayOfString() { }
+
+ // Match getIntegerCollectionArray()
+ @Before("execution(*..Collection<Integer>[] *(..))")
+ public void wildcardGenericCollectionArrayOfInteger() { }
+
+ // Do not match anything. The fact that primitive type int is illegal as a generic type parameter, is not mentioned
+ // in any warning.
+ @Before("execution(*..Collection<int>[] *(..))")
+ public void wildcardGenericCollectionArrayOfPrimitiveInt() { }
+
+ public void myVoid() { }
public Collection<?>[] getCollectionArray() {
- return null;
+ return null;
}
+
+ public Collection<Integer>[] getIntegerCollectionArray() {
+ return null;
+ }
+
}
diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc165/ajc165.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc165/ajc165.xml
index f48581f87..cfdde8700 100644
--- a/tests/src/test/resources/org/aspectj/systemtest/ajc165/ajc165.xml
+++ b/tests/src/test/resources/org/aspectj/systemtest/ajc165/ajc165.xml
@@ -78,14 +78,26 @@
<ajc-test dir="bugs165/pr272233" title="funky pointcut 2">
<compile files="Iffy2.java" options="-1.5 -showWeaveInfo">
+
+ <!-- Should occur twice, but messages are identical, so they cannot be counted -->
+ <message kind="warning" text="arrays cannot have a void type, but found 'void[]' in pointcut [Xlint:arrayCannotBeVoid]"/>
<message kind="warning" text="arrays cannot have a void type, but found 'void[]' in pointcut [Xlint:arrayCannotBeVoid]"/>
- <message kind="weave" text="advised by before advice from 'Iffy2' (Iffy2.java:8)"/>
- <message kind="weave" text="advised by before advice from 'Iffy2' (Iffy2.java:11)"/>
- <message kind="weave" text="advised by before advice from 'Iffy2' (Iffy2.java:14)"/>
- <message kind="weave" text="advised by before advice from 'Iffy2' (Iffy2.java:17)"/>
- <message kind="weave" text="advised by before advice from 'Iffy2' (Iffy2.java:20)"/>
- <!-- TODO: Activate 'Iffy2.advice6()' pointcut after pointcut parsing problem has been fixed. -->
- <!--<message kind="weave" text="advised by before advice from 'Iffy2' (Iffy2.java:XX)"/>-->
+
+ <message kind="warning" text="advice defined in Iffy2 has not been applied [Xlint:adviceDidNotMatch]" line="14"/>
+ <message kind="warning" text="advice defined in Iffy2 has not been applied [Xlint:adviceDidNotMatch]" line="39"/>
+ <message kind="warning" text="advice defined in Iffy2 has not been applied [Xlint:adviceDidNotMatch]" line="48"/>
+
+ <message kind="weave" text="method-execution(void Iffy2.myVoid())' in Type 'Iffy2' (Iffy2.java:50) advised by before advice from 'Iffy2' (Iffy2.java:23)"/>
+ <message kind="weave" text="method-execution(java.util.Collection[] Iffy2.getCollectionArray())' in Type 'Iffy2' (Iffy2.java:52) advised by before advice from 'Iffy2' (Iffy2.java:35)"/>
+ <message kind="weave" text="method-execution(java.util.Collection[] Iffy2.getCollectionArray())' in Type 'Iffy2' (Iffy2.java:52) advised by before advice from 'Iffy2' (Iffy2.java:31)"/>
+ <message kind="weave" text="method-execution(java.util.Collection[] Iffy2.getCollectionArray())' in Type 'Iffy2' (Iffy2.java:52) advised by before advice from 'Iffy2' (Iffy2.java:27)"/>
+ <message kind="weave" text="method-execution(java.util.Collection[] Iffy2.getCollectionArray())' in Type 'Iffy2' (Iffy2.java:52) advised by before advice from 'Iffy2' (Iffy2.java:23)"/>
+ <message kind="weave" text="method-execution(java.util.Collection[] Iffy2.getCollectionArray())' in Type 'Iffy2' (Iffy2.java:52) advised by before advice from 'Iffy2' (Iffy2.java:10)"/>
+ <message kind="weave" text="method-execution(java.util.Collection[] Iffy2.getIntegerCollectionArray())' in Type 'Iffy2' (Iffy2.java:56) advised by before advice from 'Iffy2' (Iffy2.java:43)"/>
+ <message kind="weave" text="method-execution(java.util.Collection[] Iffy2.getIntegerCollectionArray())' in Type 'Iffy2' (Iffy2.java:56) advised by before advice from 'Iffy2' (Iffy2.java:27)"/>
+ <message kind="weave" text="method-execution(java.util.Collection[] Iffy2.getIntegerCollectionArray())' in Type 'Iffy2' (Iffy2.java:56) advised by before advice from 'Iffy2' (Iffy2.java:23)"/>
+ <message kind="weave" text="method-execution(java.util.Collection[] Iffy2.getIntegerCollectionArray())' in Type 'Iffy2' (Iffy2.java:56) advised by before advice from 'Iffy2' (Iffy2.java:10)"/>
+
</compile>
</ajc-test>