summaryrefslogtreecommitdiffstats
path: root/tests/java5/annotations/ajdkExamples/PrecedenceAnnotations.aj
diff options
context:
space:
mode:
Diffstat (limited to 'tests/java5/annotations/ajdkExamples/PrecedenceAnnotations.aj')
-rw-r--r--tests/java5/annotations/ajdkExamples/PrecedenceAnnotations.aj45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/java5/annotations/ajdkExamples/PrecedenceAnnotations.aj b/tests/java5/annotations/ajdkExamples/PrecedenceAnnotations.aj
new file mode 100644
index 000000000..63218f7df
--- /dev/null
+++ b/tests/java5/annotations/ajdkExamples/PrecedenceAnnotations.aj
@@ -0,0 +1,45 @@
+public aspect PrecedenceAnnotations {
+
+ declare precedence : (@Security *), *;
+
+ declare precedence : *, (@Performance *);
+
+ public static void main(String[] args) {
+ A a = new A();
+ a.foo();
+ }
+}
+
+@interface Security {}
+@interface Performance{}
+
+class A {
+ pointcut foo() : execution(* foo());
+ void foo() {}
+}
+
+aspect S1 {
+ before() : A.foo() {
+ System.out.println("S1");
+ }
+}
+
+@Security aspect S2 {
+
+ before() : A.foo() {
+ System.out.println("@Security S2");
+ }
+
+}
+
+aspect P1 {
+ after() returning : A.foo() {
+ System.out.println("P1");
+ }
+}
+
+@Performance aspect P2 {
+ after() returning : A.foo() {
+ System.out.println("@Performance P2");
+ }
+} \ No newline at end of file