Added
Link Here
|
1 |
import java.lang.annotation.Retention; |
2 |
import java.lang.annotation.RetentionPolicy; |
3 |
|
4 |
@Retention(RetentionPolicy.RUNTIME) |
5 |
@interface Annotation{}; |
6 |
|
7 |
@Annotation |
8 |
public class PR113447a { |
9 |
|
10 |
public static void main(String[] args) { |
11 |
PR113447a me = new PR113447a(); |
12 |
me.method1(); |
13 |
me.method3(); |
14 |
me.method4(2); |
15 |
} |
16 |
|
17 |
public void method1(){} |
18 |
|
19 |
public void method3(){} |
20 |
|
21 |
public void method4(int i){} |
22 |
public void method5(int i){} |
23 |
} |
24 |
|
25 |
aspect Super { |
26 |
|
27 |
// second method doesn't exist |
28 |
pointcut pc1(Annotation a) : |
29 |
(@this(a) && execution(void method1())) |
30 |
|| (@this(a) && execution(void method2())); |
31 |
|
32 |
before(Annotation a) : pc1(a) {} |
33 |
|
34 |
// second method does exist |
35 |
pointcut pc2(Annotation a) : |
36 |
(@this(a) && execution(void method1())) |
37 |
|| (@this(a) && execution(void method3())); |
38 |
|
39 |
before(Annotation a) : pc2(a) {} |
40 |
|
41 |
// second method doesn't exist |
42 |
pointcut pc3(Annotation a) : |
43 |
(@target(a) && call(void method1())) |
44 |
|| (@target(a) && call(void method2())); |
45 |
|
46 |
before(Annotation a) : pc3(a) { |
47 |
} |
48 |
|
49 |
// second method does exist |
50 |
pointcut pc4(Annotation a) : |
51 |
(@target(a) && call(void method1())) |
52 |
|| (@target(a) && call(void method3())); |
53 |
|
54 |
before(Annotation a) : pc4(a) { |
55 |
} |
56 |
|
57 |
// @this equivalent of BaseTests.test024 which was affected by |
58 |
// the fix for the non annotation version |
59 |
pointcut p(Annotation a) : |
60 |
@target(a) && (call(void method4(int)) |
61 |
|| call(void method5(int))); |
62 |
|
63 |
before(Annotation a) : p(a) {} |
64 |
after(Annotation a): p(a) {} |
65 |
} |