summaryrefslogtreecommitdiffstats
path: root/tests/features160
diff options
context:
space:
mode:
authoraclement <aclement>2008-04-26 05:11:27 +0000
committeraclement <aclement>2008-04-26 05:11:27 +0000
commit896000fba2b8c82c611ff36d58e70ab72f50c3d5 (patch)
treef2e28f7a8602fb1e7d1693ee2dcb639186493ff1 /tests/features160
parent677f7d0c4b42bc9d0a4ad793747e9183e3322f3f (diff)
downloadaspectj-896000fba2b8c82c611ff36d58e70ab72f50c3d5.tar.gz
aspectj-896000fba2b8c82c611ff36d58e70ab72f50c3d5.zip
228980: tests and partial fix
Diffstat (limited to 'tests/features160')
-rw-r--r--tests/features160/parameterAnnotationMatching/Test.java56
1 files changed, 56 insertions, 0 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