From 94251be73e24166f25ee2d8ca477879fea53dfa2 Mon Sep 17 00:00:00 2001 From: aclement Date: Mon, 31 Jan 2005 14:02:38 +0000 Subject: Tests for static method call/execution with @annotation --- tests/java5/annotations/binding/StaticMethods.java | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/java5/annotations/binding/StaticMethods.java (limited to 'tests/java5') diff --git a/tests/java5/annotations/binding/StaticMethods.java b/tests/java5/annotations/binding/StaticMethods.java new file mode 100644 index 000000000..385ea70c8 --- /dev/null +++ b/tests/java5/annotations/binding/StaticMethods.java @@ -0,0 +1,28 @@ +import java.lang.annotation.*; + +@Retention(RetentionPolicy.RUNTIME) +@interface Colored {String value();} + + +public class StaticMethods { + + public static void main(String[] argv) { + m1(); + m2(); + } + + + @Colored("red") static void m1() {System.err.println("m1 running");} + @Colored("blue") static void m2() {System.err.println("m2 running");} + + static aspect X { + before(Colored c): call(* m*(..)) && @annotation(c) { + System.err.println("Color at "+thisJoinPoint+" is "+c.value()); + } + before(Colored c): execution(* m*(..)) && @annotation(c) { + System.err.println("Color at "+thisJoinPoint+" is "+c.value()); + } + } + +} + -- cgit v1.2.3