summaryrefslogtreecommitdiffstats
path: root/tests/java5/annotations/binding/AtArgs2.aj
diff options
context:
space:
mode:
authoraclement <aclement>2005-02-03 11:04:59 +0000
committeraclement <aclement>2005-02-03 11:04:59 +0000
commit0dde9d61b534fd84462d2b6a52b6d21d624d3077 (patch)
treefa0507937c18f56075db24d5df320cf7daee277e /tests/java5/annotations/binding/AtArgs2.aj
parent6f0757c734decca7642514caf1ce5f06dc829abd (diff)
downloadaspectj-0dde9d61b534fd84462d2b6a52b6d21d624d3077.tar.gz
aspectj-0dde9d61b534fd84462d2b6a52b6d21d624d3077.zip
Annotation Binding: testcases for @this/@args and one for using named pointcuts with annotations.
Diffstat (limited to 'tests/java5/annotations/binding/AtArgs2.aj')
-rw-r--r--tests/java5/annotations/binding/AtArgs2.aj28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/java5/annotations/binding/AtArgs2.aj b/tests/java5/annotations/binding/AtArgs2.aj
new file mode 100644
index 000000000..ed46d6186
--- /dev/null
+++ b/tests/java5/annotations/binding/AtArgs2.aj
@@ -0,0 +1,28 @@
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME) @interface Colored { String color(); }
+@Retention(RetentionPolicy.RUNTIME) @interface Fruit { String value(); }
+
+@Colored(color="yellow") @Fruit("banana") class YB {}
+
+public class AtArgs2 {
+ public static void main(String[]argv) {
+ m(new YB());
+ if (!X.run) throw new Error("Advice should have run");
+ }
+
+ public static void m(Object a) {}
+
+}
+
+aspect X {
+ public static boolean run = false;
+ before(Colored c): call(* m(..)) && !within(X) && @args(c) {
+ System.err.println("Color is "+c.color());
+ run = true;
+ if (!c.color().equals("yellow"))
+ throw new RuntimeException("Color should be yellow: "+c.color());
+ }
+
+}
+