summaryrefslogtreecommitdiffstats
path: root/tests/java5/annotations/aspectMembers/a/AnnotatedAspect05.aj
blob: c4832bfe82373a0869dab896b5108474fd7febe7 (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
package a;

import org.aspectj.lang.annotation.SuppressAjWarnings;
import java.lang.annotation.Annotation;

@TypeAnnotation
public aspect AnnotatedAspect05 {
	
//	@ConstructorAnnotation 
//	before() : execution(* *(..)) {}
	
	@MethodAnnotation
	@SuppressAjWarnings
	after() returning : set(* *) {}
	
	@AnyAnnotation
	after() throwing : get(* *) {}
	
	@MethodAnnotation
	@SuppressAjWarnings
	after() : handler(*) {}
	
	@MethodAnnotation
	@SuppressAjWarnings("adviceDidNotMatch")
	Object around() : call(new(..)) { return proceed(); }
	
	public static void main(String[] args) {
  		java.lang.reflect.Method[] methods = AnnotatedAspect05.class.getDeclaredMethods();
  		for (int i = 0; i < methods.length; i++) {
			if (methods[i].getName().startsWith("ajc$afterThrowing")) {
				Annotation annotation = methods[i].getAnnotation(AnyAnnotation.class);
				if (annotation == null) {
					throw new RuntimeException("advice should be annotated");
				}
			}
		}
	}
}