blob: 9171f2f73b892658c2d999c49235d06d0c8486e9 (
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
|
import java.io.FileNotFoundException;
import org.aspectj.lang.annotation.AdviceName;
public aspect AdviceExecution {
// don't want the 'declared exception not actually
// thrown' warning against this piece of advice
@AdviceName("Test")
before() throws FileNotFoundException : execution(* C.method1(..)) {
}
before(AdviceName name) throws FileNotFoundException : adviceexecution()
&& @annotation(name)
&& if(name.value().indexOf("Test") != -1) {
throw new FileNotFoundException();
}
}
class C {
// don't want the 'declared exception not actually
// thrown' warning
public void method1() throws FileNotFoundException {
}
}
|