mirror of
https://github.com/eclipse-aspectj/aspectj.git
synced 2024-09-03 05:54:57 +02:00
28 lines
652 B
Plaintext
28 lines
652 B
Plaintext
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 {
|
|
}
|
|
}
|