summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoraclement <aclement>2008-02-22 22:28:54 +0000
committeraclement <aclement>2008-02-22 22:28:54 +0000
commit62871f3aee37edaf8a2cc867e39b0e37b94b7a47 (patch)
tree3467a104564ba05fc3f8ce800be07d0d72d38bcf /tests
parent2e55637ff567455b60cea150ff3478456816b65f (diff)
downloadaspectj-62871f3aee37edaf8a2cc867e39b0e37b94b7a47.tar.gz
aspectj-62871f3aee37edaf8a2cc867e39b0e37b94b7a47.zip
parameter value matching: testcode
Diffstat (limited to 'tests')
-rw-r--r--tests/features160/parameterValueMatching/Broken1.java29
-rw-r--r--tests/features160/parameterValueMatching/Color.java3
-rw-r--r--tests/features160/parameterValueMatching/EnumTest1.java14
-rw-r--r--tests/features160/parameterValueMatching/EnumTest2.java14
-rw-r--r--tests/features160/parameterValueMatching/EnumTest3.java14
-rw-r--r--tests/features160/parameterValueMatching/Fruit.java3
-rw-r--r--tests/features160/parameterValueMatching/Fruity.java5
-rw-r--r--tests/features160/parameterValueMatching/Parsing.java32
-rw-r--r--tests/features160/parameterValueMatching/Simple.java29
-rw-r--r--tests/features160/parameterValueMatching/TrafficLight.java5
10 files changed, 148 insertions, 0 deletions
diff --git a/tests/features160/parameterValueMatching/Broken1.java b/tests/features160/parameterValueMatching/Broken1.java
new file mode 100644
index 000000000..ab0877c74
--- /dev/null
+++ b/tests/features160/parameterValueMatching/Broken1.java
@@ -0,0 +1,29 @@
+enum Color { RED, GREEN, AMBER }
+
+@interface TrafficLight {
+ Color value() default Color.RED;
+}
+
+public class Broken1 {
+ public static void main(String[] args) {
+
+ }
+}
+
+class Marked {
+
+ public void a() {}
+
+ @TrafficLight
+ public void b() {}
+
+ @TrafficLight(Color.RED)
+ public void c() {}
+
+ @TrafficLight(Color.GREEN)
+ public void d() {}
+}
+
+aspect X {
+ pointcut p1(): execution(@TrafficLight(a) * *(..)); // value of just 'a' doesn't mean anything - only enums supported right now, let's say 'invalid annotation value'
+}
diff --git a/tests/features160/parameterValueMatching/Color.java b/tests/features160/parameterValueMatching/Color.java
new file mode 100644
index 000000000..086ba29a3
--- /dev/null
+++ b/tests/features160/parameterValueMatching/Color.java
@@ -0,0 +1,3 @@
+package p;
+
+public enum Color { RED, GREEN, AMBER }
diff --git a/tests/features160/parameterValueMatching/EnumTest1.java b/tests/features160/parameterValueMatching/EnumTest1.java
new file mode 100644
index 000000000..47966ecbd
--- /dev/null
+++ b/tests/features160/parameterValueMatching/EnumTest1.java
@@ -0,0 +1,14 @@
+package a;
+
+import p.*;
+
+public aspect EnumTest1 {
+ public static void main(String[] argv) {
+
+ }
+ @TrafficLight(Color.RED) public void m() {}
+ @TrafficLight(Color.GREEN) public void n() {}
+ @TrafficLight public void o() {}
+
+ before(): execution(@TrafficLight(Color.RED) * *(..)) {} // referencing Color via import of p.*
+} \ No newline at end of file
diff --git a/tests/features160/parameterValueMatching/EnumTest2.java b/tests/features160/parameterValueMatching/EnumTest2.java
new file mode 100644
index 000000000..b19593906
--- /dev/null
+++ b/tests/features160/parameterValueMatching/EnumTest2.java
@@ -0,0 +1,14 @@
+package a;
+
+import p.*;
+
+public aspect EnumTest2 {
+ public static void main(String[] argv) {
+
+ }
+ @TrafficLight(Color.RED) public void m() {}
+ @TrafficLight(Color.GREEN) public void n() {}
+ @TrafficLight public void o() {}
+
+ before(): execution(@TrafficLight(p.Color.RED) * *(..)) {}; // referencing Color directly in package p
+} \ No newline at end of file
diff --git a/tests/features160/parameterValueMatching/EnumTest3.java b/tests/features160/parameterValueMatching/EnumTest3.java
new file mode 100644
index 000000000..f6f3f162a
--- /dev/null
+++ b/tests/features160/parameterValueMatching/EnumTest3.java
@@ -0,0 +1,14 @@
+package a;
+
+import p.*;
+
+public aspect EnumTest3 {
+ public static void main(String[] argv) {
+
+ }
+ @q.r.Fruity(q.r.Fruit.APPLE) public void m() {}
+ @q.r.Fruity(q.r.Fruit.BANANA) public void n() {}
+ @q.r.Fruity public void o() {}
+
+ before(): execution(@q.r.Fruity(q.r.Fruit.APPLE) * *(..)) {}; // static import of fruits
+} \ No newline at end of file
diff --git a/tests/features160/parameterValueMatching/Fruit.java b/tests/features160/parameterValueMatching/Fruit.java
new file mode 100644
index 000000000..1ea650033
--- /dev/null
+++ b/tests/features160/parameterValueMatching/Fruit.java
@@ -0,0 +1,3 @@
+package q.r;
+
+public enum Fruit { APPLE, ORANGE, BANANA }
diff --git a/tests/features160/parameterValueMatching/Fruity.java b/tests/features160/parameterValueMatching/Fruity.java
new file mode 100644
index 000000000..5635bf51c
--- /dev/null
+++ b/tests/features160/parameterValueMatching/Fruity.java
@@ -0,0 +1,5 @@
+package q.r;
+
+public @interface Fruity {
+ Fruit value() default Fruit.BANANA;
+} \ No newline at end of file
diff --git a/tests/features160/parameterValueMatching/Parsing.java b/tests/features160/parameterValueMatching/Parsing.java
new file mode 100644
index 000000000..f541a8610
--- /dev/null
+++ b/tests/features160/parameterValueMatching/Parsing.java
@@ -0,0 +1,32 @@
+enum Color { RED, GREEN, AMBER }
+
+@interface TrafficLight {
+ Color value() default Color.RED;
+}
+
+public class Parsing {
+ public static void main(String[] args) {
+
+ }
+}
+
+class Marked {
+
+ public void a() {}
+
+ @TrafficLight
+ public void b() {}
+
+ @TrafficLight(Color.RED)
+ public void c() {}
+
+ @TrafficLight(Color.GREEN)
+ public void d() {}
+}
+
+aspect X {
+ pointcut p1(): execution(@TrafficLight(Color.GREEN) * *(..));
+ pointcut p2(): execution(@TrafficLight(a=Color.GREEN) * *(..));
+ pointcut p3(): execution(@TrafficLight(a=Color.RED,c=Color.RED) * *(..));
+ pointcut p4(): execution(@TrafficLight(a=Color.RED,c=Color.RED,e=Color.RED) * *(..));
+} \ No newline at end of file
diff --git a/tests/features160/parameterValueMatching/Simple.java b/tests/features160/parameterValueMatching/Simple.java
new file mode 100644
index 000000000..d70e2a8a8
--- /dev/null
+++ b/tests/features160/parameterValueMatching/Simple.java
@@ -0,0 +1,29 @@
+enum Color { RED, GREEN, AMBER }
+
+@interface TrafficLight {
+ Color value() default Color.RED;
+}
+
+public class Simple {
+ public static void main(String[] args) {
+
+ }
+}
+
+class Marked {
+
+ public void a() {}
+
+ @TrafficLight
+ public void b() {}
+
+ @TrafficLight(Color.RED)
+ public void c() {}
+
+ @TrafficLight(Color.GREEN)
+ public void d() {}
+}
+
+aspect X {
+ before(): execution(@TrafficLight(Color.RED) * *(..)) {}
+} \ No newline at end of file
diff --git a/tests/features160/parameterValueMatching/TrafficLight.java b/tests/features160/parameterValueMatching/TrafficLight.java
new file mode 100644
index 000000000..3d1fbc818
--- /dev/null
+++ b/tests/features160/parameterValueMatching/TrafficLight.java
@@ -0,0 +1,5 @@
+package p;
+
+public @interface TrafficLight {
+ Color value() default Color.RED;
+} \ No newline at end of file