summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/features160/parameterAnnotationMatching/Test.java56
-rw-r--r--tests/src/org/aspectj/systemtest/ajc160/ParameterAnnotationMatchingTests.java5
-rw-r--r--tests/src/org/aspectj/systemtest/ajc160/parameterAnnotations.xml21
3 files changed, 80 insertions, 2 deletions
diff --git a/tests/features160/parameterAnnotationMatching/Test.java b/tests/features160/parameterAnnotationMatching/Test.java
new file mode 100644
index 000000000..2a5aa2480
--- /dev/null
+++ b/tests/features160/parameterAnnotationMatching/Test.java
@@ -0,0 +1,56 @@
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+public aspect Test {
+ // OK (matches f1 and f2):
+ declare warning : execution(* *(!(Object+), ..)) : "mOne: value parameter";
+
+ // Wrong (matches f1 and f2, should match only f1): a Not type pattern containing @A and negatedPattern Object+ is built
+//broke declare warning : execution(* *(@A (!(Object+)), ..)) : "mTwo: @A annotated value parameter";
+
+ // OK (matches f1):
+ declare warning : execution(* *(@A (*), ..)) && execution(* *(!(Object+), ..)): "mThree: @A annotated value parameter.";
+
+ // OK (matches f3 and f4):
+ declare warning : execution(* *(Object+, ..)) : "mFour: Reference parameter.";
+
+ // Wrong (no matches, should match f3):
+ declare warning : execution(* *(@A (Object+), ..)) : "mFive: @A annotated reference parameter!";
+
+ // OK (matches f3):
+ declare warning : execution(* *(@A (*), ..)) && execution(* *(Object+, ..)): "mSix: @A annotated reference parameter.";
+
+ // Wrong (matches f1 and f2, should match only f2):
+//broke declare warning : execution(* *(!@A (!(Object+)), ..)) : "mSeven: Non-@A annotated value parameter!";
+
+ // Wrong (matches f1 and f2, should match only f2):
+ declare warning : execution(* *(!@A (*), ..)) && execution(* *(!(Object+), ..)): "mEight: Non-@A annotated value parameter.";
+
+ // OK (matches f2):
+ declare warning : !execution(* *(@A (*), ..)) && execution(* *(!(Object+), ..)): "mNine: Non-@A annotated value parameter.";
+
+ // Wrong (matches f3 and f4, should match only f4):
+ declare warning : execution(* *(!@A (Object+), ..)) : "mTen: Non-@A annotated reference parameter!";
+
+ // Wrong (matches f3 and f4, should match only f4):
+ declare warning : execution(* *(!@A (*), ..)) && execution(* *(Object+, ..)): "mEleven: Non-@A annotated reference parameter.";
+
+ // OK (matches f4):
+ declare warning : !execution(* *(@A (*), ..)) && execution(* *(Object+, ..)): "mTwelve: Non-@A annotated reference parameter.";
+
+ void f1(@A int i) {}
+
+ void f2(int i) {}
+
+ void f3(@A Integer i) {}
+
+ void f4(Integer i) {}
+
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target({ElementType.PARAMETER})
+ private static @interface A {
+
+ }
+} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc160/ParameterAnnotationMatchingTests.java b/tests/src/org/aspectj/systemtest/ajc160/ParameterAnnotationMatchingTests.java
index 97e6c9222..4e6677879 100644
--- a/tests/src/org/aspectj/systemtest/ajc160/ParameterAnnotationMatchingTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc160/ParameterAnnotationMatchingTests.java
@@ -14,10 +14,10 @@ package org.aspectj.systemtest.ajc160;
import java.io.File;
-import org.aspectj.testing.XMLBasedAjcTestCase;
-
import junit.framework.Test;
+import org.aspectj.testing.XMLBasedAjcTestCase;
+
/**
* Parameter annotation matching
*
@@ -76,6 +76,7 @@ import junit.framework.Test;
*/
public class ParameterAnnotationMatchingTests extends XMLBasedAjcTestCase {
+ public void testDeow() { runTest("deow"); }
public void testNoWarningForWrongType() { runTest("no xlint for wrong target");}
public void testVariousCombinations() { runTest("various combinations"); }
public void testVariousCombinationsCtors() { runTest("various combinations - ctors"); }
diff --git a/tests/src/org/aspectj/systemtest/ajc160/parameterAnnotations.xml b/tests/src/org/aspectj/systemtest/ajc160/parameterAnnotations.xml
index 540307665..47d8598b3 100644
--- a/tests/src/org/aspectj/systemtest/ajc160/parameterAnnotations.xml
+++ b/tests/src/org/aspectj/systemtest/ajc160/parameterAnnotations.xml
@@ -4,6 +4,27 @@
<suite>
+ <ajc-test dir="features160/parameterAnnotationMatching" title="deow">
+ <compile options="-1.5" files="Test.java">
+ <message kind="warning" line="43" text="mOne"/>
+ <message kind="warning" line="45" text="mOne"/>
+ <message kind="warning" line="43" text="mThree"/>
+ <message kind="warning" line="47" text="mFour"/>
+ <message kind="warning" line="49" text="mFour"/>
+ <message kind="warning" line="47" text="mFive"/>
+ <message kind="warning" line="47" text="mSix"/>
+ <message kind="warning" line="45" text="mNine"/>
+ <message kind="warning" line="49" text="mEleven"/>
+ <message kind="warning" line="49" text="mTwelve"/>
+ <message kind="warning" line="49" text="mTen"/>
+ <message kind="warning" line="45" text="mEight"/>
+ <!--
+ <message kind="warning" line="43" text="mTwo"/>
+ <message kind="warning" line="45" text="mSeven"/>
+ -->
+ </compile>
+ </ajc-test>
+
<ajc-test dir="features160/parameterAnnotationMatching" title="no xlint for wrong target">
<compile options="-1.5" files="NonNullAssertionForcer.java"/>
</ajc-test>