aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2005-01-31 14:02:38 +0000
committeraclement <aclement>2005-01-31 14:02:38 +0000
commit94251be73e24166f25ee2d8ca477879fea53dfa2 (patch)
treeb3196b3592a1391870ba77e2f3893eb611f3a98e
parent51aedc9a20c3c571f01bbfd79ca357759e008479 (diff)
downloadaspectj-94251be73e24166f25ee2d8ca477879fea53dfa2.tar.gz
aspectj-94251be73e24166f25ee2d8ca477879fea53dfa2.zip
Tests for static method call/execution with @annotation
-rw-r--r--tests/java5/annotations/binding/StaticMethods.java28
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/AnnotationBinding.java7
2 files changed, 35 insertions, 0 deletions
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());
+ }
+ }
+
+}
+
diff --git a/tests/src/org/aspectj/systemtest/ajc150/AnnotationBinding.java b/tests/src/org/aspectj/systemtest/ajc150/AnnotationBinding.java
index 0af6b4560..b1fd803bc 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/AnnotationBinding.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/AnnotationBinding.java
@@ -144,4 +144,11 @@ public class AnnotationBinding extends TestUtils {
assertMessages(cR,new EmptyMessageSpec());
RunResult rR = run("a.b.c.A");
}
+
+ // Binding with calls/executions of static methods
+ public void testCallsAndExecutionsOfStaticMethods() {
+ CompilationResult cR = ajc(baseDir,new String[]{"StaticMethods.java","-1.5","-d","."});
+ assertMessages(cR,new EmptyMessageSpec());
+ RunResult rR = run("StaticMethods");
+ }
} \ No newline at end of file