summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Clement2018-04-18 11:29:35 -0400
committerAndy Clement2018-04-18 11:29:35 -0400
commitce81592441c82ba3552e6ec9394fbc88ea717cd1 (patch)
tree01ab5794028631bc356e5b5b84fa0f1c2e83b052
parentb2cb18ef127097ad2c258b9d061cc70b5fb19432 (diff)
downloadorg.aspectj-param_anno_matching_change.tar.gz
org.aspectj-param_anno_matching_change.tar.xz
org.aspectj-param_anno_matching_change.zip
-rw-r--r--org.aspectj.matcher/src/org/aspectj/weaver/patterns/SignaturePattern.java15
-rw-r--r--tests/bugs190/532210/Code.java17
-rw-r--r--tests/bugs190/532210/Code2.classbin0 -> 289 bytes
-rw-r--r--tests/bugs190/532210/Code2.java18
-rw-r--r--tests/bugs190/532210/Code3.classbin0 -> 905 bytes
-rw-r--r--tests/bugs190/532210/Code3.java24
-rw-r--r--tests/bugs190/532210/I.classbin0 -> 221 bytes
-rw-r--r--tests/bugs190/532210/Nullable.classbin0 -> 313 bytes
-rw-r--r--tests/bugs190/532210/P.classbin0 -> 279 bytes
-rw-r--r--tests/bugs190/532210/PA.classbin0 -> 268 bytes
-rw-r--r--tests/bugs190/532210/TA.classbin0 -> 268 bytes
-rw-r--r--tests/bugs190/532210/X.classbin0 -> 2515 bytes
-rw-r--r--tests/src/org/aspectj/systemtest/ajc190/Ajc190Tests.java4
-rw-r--r--tests/src/org/aspectj/systemtest/ajc190/ajc190.xml6
14 files changed, 80 insertions, 4 deletions
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/SignaturePattern.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/SignaturePattern.java
index 365b5b7a7..3fcc2eb0b 100644
--- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/SignaturePattern.java
+++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/SignaturePattern.java
@@ -532,18 +532,27 @@ public class SignaturePattern extends PatternNode implements ISignaturePattern {
ResolvableTypeList rtl = new ResolvableTypeList(world, aMethod.getParameterTypes());
// Only fetch the parameter annotations if the pointcut is going to be matching on them
ResolvedType[][] parameterAnnotationTypes = null;
- if (isMatchingParameterAnnotations()) {
+ boolean paramAnnoMatching = false;
+ // if there are parameterAnnotationTypes then only be concerned if a subjectMatch
+ if (subjectMatch && isMatchingParameterAnnotations()) {
parameterAnnotationTypes = aMethod.getParameterAnnotationTypes();
if (parameterAnnotationTypes != null && parameterAnnotationTypes.length == 0) {
parameterAnnotationTypes = null;
}
+ paramAnnoMatching = true;
}
if (!parameterTypes.matches(rtl, TypePattern.STATIC, parameterAnnotationTypes).alwaysTrue()) {
// It could still be a match based on the generic sig parameter types of a parameterized type
- if (!parameterTypes.matches(new ResolvableTypeList(world, aMethod.getGenericParameterTypes()), TypePattern.STATIC,
- parameterAnnotationTypes).alwaysTrue()) {
+ FuzzyBoolean matches = parameterTypes.matches(new ResolvableTypeList(world, aMethod.getGenericParameterTypes()), TypePattern.STATIC,
+ parameterAnnotationTypes);
+ if (!matches.alwaysTrue()) {
+ if (paramAnnoMatching && matches.alwaysFalse()) {
+ return FuzzyBoolean.NO;
+ }
return FuzzyBoolean.MAYBE;
+// return FuzzyBoolean.NO;//
+// return matches.alwaysFalse()?FuzzyBoolean.NO:FuzzyBoolean.MAYBE;
// It could STILL be a match based on the erasure of the parameter types??
// to be determined via test cases...
}
diff --git a/tests/bugs190/532210/Code.java b/tests/bugs190/532210/Code.java
new file mode 100644
index 000000000..da614d2df
--- /dev/null
+++ b/tests/bugs190/532210/Code.java
@@ -0,0 +1,17 @@
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface Nullable {}
+
+interface I {
+ void n(Object o);
+}
+
+public class Code implements I {
+ public void m(@Nullable Object v) {}
+ @Override public void n(@Nullable Object v) {}
+}
+
+aspect X {
+ before(Object o): execution(* *(!@Nullable (*))) && args(o) { }
+}
diff --git a/tests/bugs190/532210/Code2.class b/tests/bugs190/532210/Code2.class
new file mode 100644
index 000000000..cad1870fb
--- /dev/null
+++ b/tests/bugs190/532210/Code2.class
Binary files differ
diff --git a/tests/bugs190/532210/Code2.java b/tests/bugs190/532210/Code2.java
new file mode 100644
index 000000000..bcc9d79a8
--- /dev/null
+++ b/tests/bugs190/532210/Code2.java
@@ -0,0 +1,18 @@
+import java.lang.annotation.*;
+
+/*
+@Retention(RetentionPolicy.RUNTIME)
+@Inherited
+@interface Nullable {}
+
+@Nullable
+interface I {
+ void n();
+}
+
+*/
+public class Code2 {
+ public static void main(String []argv) {
+ Object o = (Object[])argv;
+ }
+}
diff --git a/tests/bugs190/532210/Code3.class b/tests/bugs190/532210/Code3.class
new file mode 100644
index 000000000..3141cf945
--- /dev/null
+++ b/tests/bugs190/532210/Code3.class
Binary files differ
diff --git a/tests/bugs190/532210/Code3.java b/tests/bugs190/532210/Code3.java
new file mode 100644
index 000000000..c644ab633
--- /dev/null
+++ b/tests/bugs190/532210/Code3.java
@@ -0,0 +1,24 @@
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface PA {}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface TA {}
+
+@TA class P {}
+
+aspect X {
+ declare warning: execution(* a(@PA (@TA *))): "has param anno and type anno";
+}
+
+public class Code3 {
+ public static void main(String []argv) {
+ Object o = (Object[])argv;
+ }
+
+ public void a(P p) {}
+ public void b(String q) {}
+ public void c(@PA P p) {}
+ public void d(@PA String q) {}
+}
diff --git a/tests/bugs190/532210/I.class b/tests/bugs190/532210/I.class
new file mode 100644
index 000000000..b0971e159
--- /dev/null
+++ b/tests/bugs190/532210/I.class
Binary files differ
diff --git a/tests/bugs190/532210/Nullable.class b/tests/bugs190/532210/Nullable.class
new file mode 100644
index 000000000..b4134f57f
--- /dev/null
+++ b/tests/bugs190/532210/Nullable.class
Binary files differ
diff --git a/tests/bugs190/532210/P.class b/tests/bugs190/532210/P.class
new file mode 100644
index 000000000..649311021
--- /dev/null
+++ b/tests/bugs190/532210/P.class
Binary files differ
diff --git a/tests/bugs190/532210/PA.class b/tests/bugs190/532210/PA.class
new file mode 100644
index 000000000..a73ebdb68
--- /dev/null
+++ b/tests/bugs190/532210/PA.class
Binary files differ
diff --git a/tests/bugs190/532210/TA.class b/tests/bugs190/532210/TA.class
new file mode 100644
index 000000000..62faabf6e
--- /dev/null
+++ b/tests/bugs190/532210/TA.class
Binary files differ
diff --git a/tests/bugs190/532210/X.class b/tests/bugs190/532210/X.class
new file mode 100644
index 000000000..c53448b2c
--- /dev/null
+++ b/tests/bugs190/532210/X.class
Binary files differ
diff --git a/tests/src/org/aspectj/systemtest/ajc190/Ajc190Tests.java b/tests/src/org/aspectj/systemtest/ajc190/Ajc190Tests.java
index 3d3659f77..2f003cfbe 100644
--- a/tests/src/org/aspectj/systemtest/ajc190/Ajc190Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc190/Ajc190Tests.java
@@ -22,6 +22,10 @@ import junit.framework.Test;
*/
public class Ajc190Tests extends XMLBasedAjcTestCaseForJava9OrLater {
+ public void testParamAnnoInheritance() {
+ runTest("param anno inheritance");
+ }
+
public void testParamAnnosNegative() {
runTest("param annos negative");
}
diff --git a/tests/src/org/aspectj/systemtest/ajc190/ajc190.xml b/tests/src/org/aspectj/systemtest/ajc190/ajc190.xml
index dc311f63f..a603e9647 100644
--- a/tests/src/org/aspectj/systemtest/ajc190/ajc190.xml
+++ b/tests/src/org/aspectj/systemtest/ajc190/ajc190.xml
@@ -2,6 +2,11 @@
<suite>
+ <ajc-test dir="bugs190/532210" title="param anno inheritance">
+ <compile files="Code.java" options="-1.9 -showWeaveInfo">
+ <message kind="warning" text="advice defined in X has not been applied"/>
+ </compile>
+ </ajc-test>
<ajc-test dir="bugs190/paramannos" title="param annos negative">
<compile files="Code.java" options="-1.9 -showWeaveInfo">
@@ -9,7 +14,6 @@
</compile>
</ajc-test>
-
<ajc-test dir="bugs190/modules/aaa" title="build a module">
<compile files="module-info.java com/foo1/C1.java" options="-1.9"/>
</ajc-test>