diff options
author | aclement <aclement> | 2005-02-01 08:03:33 +0000 |
---|---|---|
committer | aclement <aclement> | 2005-02-01 08:03:33 +0000 |
commit | fd3b7dc5342d95ce675aea787e16222b4413e9c1 (patch) | |
tree | 8a2b87e005d210479a91a3125196ebc1ae1d9be7 /tests/java5/annotations/binding/FieldAnnBinding1.aj | |
parent | 94251be73e24166f25ee2d8ca477879fea53dfa2 (diff) | |
download | aspectj-fd3b7dc5342d95ce675aea787e16222b4413e9c1.tar.gz aspectj-fd3b7dc5342d95ce675aea787e16222b4413e9c1.zip |
Annotation Binding - more test data.
Diffstat (limited to 'tests/java5/annotations/binding/FieldAnnBinding1.aj')
-rw-r--r-- | tests/java5/annotations/binding/FieldAnnBinding1.aj | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/java5/annotations/binding/FieldAnnBinding1.aj b/tests/java5/annotations/binding/FieldAnnBinding1.aj new file mode 100644 index 000000000..68f8c3313 --- /dev/null +++ b/tests/java5/annotations/binding/FieldAnnBinding1.aj @@ -0,0 +1,39 @@ +import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface Colored { String color();}
+
+public class FieldAnnBinding1 {
+
+ @Colored(color="red") static int i;
+
+ @Colored(color="blue") String s;
+
+ @Colored(color="green") boolean b;
+
+ public static void main(String[]argv) {
+ i = 5;
+ new FieldAnnBinding1().s = "abc";
+ new FieldAnnBinding1().b = true;
+ X.verifyRun();
+ }
+}
+
+aspect X {
+
+ // Expected color order
+ static String exp[] = new String[]{"red","blue","green"};
+
+ static int i = 0; // Count of advice executions
+
+ before(Colored c): set(* *) && withincode(* main(..)) && @annotation(c) {
+ System.err.println(thisJoinPoint+" color="+c.color());
+ if (!c.color().equals(exp[i])) throw new RuntimeException("not "+exp[i]+"? "+c.color());
+ i++;
+ }
+
+ public static void verifyRun() {
+ if (X.i != exp.length)
+ throw new RuntimeException("Expected "+exp.length+" advice runs but did "+X.i);
+ }
+}
|