mirror of
https://github.com/eclipse-aspectj/aspectj.git
synced 2024-09-03 05:54:57 +02:00
39 lines
723 B
Plaintext
39 lines
723 B
Plaintext
import java.io.FileNotFoundException;
|
|
|
|
public aspect MethodCall {
|
|
|
|
pointcut p() : call(public * C1.m2());
|
|
|
|
before() throws FileNotFoundException : p() {
|
|
throw new FileNotFoundException();
|
|
}
|
|
|
|
pointcut p2() : call(public * C1.m4());
|
|
|
|
before() : p2() {
|
|
}
|
|
|
|
}
|
|
|
|
class C1 {
|
|
|
|
public void m1() throws FileNotFoundException {
|
|
new C1().m2();
|
|
}
|
|
|
|
// don't want the 'declared exception not actually
|
|
// thrown' warning because the advice is affecting
|
|
// this method
|
|
public void m2() throws FileNotFoundException {
|
|
}
|
|
|
|
public void m3() throws FileNotFoundException {
|
|
new C1().m4();
|
|
}
|
|
|
|
// do want the 'declared exception not actually
|
|
// thrown' warning
|
|
public void m4() throws FileNotFoundException {
|
|
}
|
|
}
|