aboutsummaryrefslogtreecommitdiffstats
path: root/tests/java5/annotations/binding/FieldAnnBinding3.aj
diff options
context:
space:
mode:
Diffstat (limited to 'tests/java5/annotations/binding/FieldAnnBinding3.aj')
-rw-r--r--tests/java5/annotations/binding/FieldAnnBinding3.aj39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/java5/annotations/binding/FieldAnnBinding3.aj b/tests/java5/annotations/binding/FieldAnnBinding3.aj
new file mode 100644
index 000000000..a6ccb683c
--- /dev/null
+++ b/tests/java5/annotations/binding/FieldAnnBinding3.aj
@@ -0,0 +1,39 @@
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface Colored { String color();}
+
+public class FieldAnnBinding3 {
+
+ @Colored(color="red") String s[];
+
+ @Colored(color="blue") boolean b[];
+
+ public static void main(String[]argv) {
+ FieldAnnBinding3 fab = new FieldAnnBinding3();
+ fab.s = new String[]{"abc","def"};
+ fab.b = new boolean[]{true,false,true};
+
+ System.err.println("s="+fab.s);
+ System.err.println("b="+fab.b);
+ X.verifyRun();
+ }
+}
+aspect X {
+
+ // Expected color order
+ static String exp[] = new String[]{"red","blue"};
+
+ static int i = 0; // Count of advice executions
+
+ before(Colored c): get(* *) && 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);
+ }
+} \ No newline at end of file