miroir de
https://github.com/eclipse-aspectj/aspectj.git
synchronisé 2024-09-03 05:54:57 +02:00
26 lignes
538 B
Java
26 lignes
538 B
Java
import org.aspectj.testing.Tester;
|
|
|
|
public class ThrowsMatching {
|
|
public static void main(String[] args) throws Exception {
|
|
C c = new C();
|
|
c.m1();
|
|
c.m2();
|
|
|
|
Tester.checkEqual(A.buf.toString(), "before:m1:m2:");
|
|
}
|
|
}
|
|
|
|
|
|
class E1 extends Exception { }
|
|
|
|
class C {
|
|
public void m1() throws E1 { A.buf.append("m1:"); }
|
|
public void m2() { A.buf.append("m2:"); }
|
|
}
|
|
|
|
aspect A {
|
|
static StringBuffer buf = new StringBuffer();
|
|
|
|
before(): call(void C.m*() throws E1) { A.buf.append("before:"); }
|
|
}
|