You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ThrowsMatching.java 538B

12345678910111213141516171819202122232425
  1. import org.aspectj.testing.Tester;
  2. public class ThrowsMatching {
  3. public static void main(String[] args) throws Exception {
  4. C c = new C();
  5. c.m1();
  6. c.m2();
  7. Tester.checkEqual(A.buf.toString(), "before:m1:m2:");
  8. }
  9. }
  10. class E1 extends Exception { }
  11. class C {
  12. public void m1() throws E1 { A.buf.append("m1:"); }
  13. public void m2() { A.buf.append("m2:"); }
  14. }
  15. aspect A {
  16. static StringBuffer buf = new StringBuffer();
  17. before(): call(void C.m*() throws E1) { A.buf.append("before:"); }
  18. }