aboutsummaryrefslogtreecommitdiffstats
path: root/tests/java5/annotations/ajdkExamples/PrecedenceAnnotations.aj
blob: 63218f7dfb2981e8ddb2a2472209c3fa4c417cab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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");
	}
}