blob: 0cb1ed514bfbcdfc9b2226da4c0bc3c347bfb829 (
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
|
import java.lang.annotation.*;
import org.aspectj.lang.annotation.*;
import org.aspectj.lang.*;
@Aspect class A {
@Pointcut("execution(@Tracing * *(..)) && @annotation(tracing)")
void annotatedMethods(Tracing tracing) { }
@AfterThrowing(pointcut = "annotatedMethods(tracing)", throwing = "t")
public void logException(JoinPoint thisJoinPoint, Tracing tracing,Throwable t) {
}
}
@Retention(RetentionPolicy.RUNTIME)
@interface Tracing { }
public class Test {
@Tracing
public void m() {}
public static void main(String []argv) {}
}
|