選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

AfterThrowingNonThrowable.java 989B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import org.aspectj.testing.Tester;
  2. import java.util.*;
  3. /** @testcase PR#832 after throwing advice with non-throwable formal */
  4. public class AfterThrowingNonThrowable {
  5. public static void main(String[] args) {
  6. U.ee("after() throwing (Object o) : call(void C.run())");
  7. U.ee("run()");
  8. C c = new C();
  9. boolean gotError = false;
  10. try {
  11. c.run();
  12. } catch (Error e) {
  13. gotError = true;
  14. }
  15. Tester.check(gotError, "failed to get error");
  16. Tester.checkAllEvents();
  17. }
  18. }
  19. class C {
  20. public void run() {
  21. U.e("run()");
  22. throw new Error("");
  23. }
  24. }
  25. class U {
  26. static void e(String event) {
  27. //System.err.println(event);
  28. Tester.event(event);
  29. }
  30. static void ee(String event) {
  31. Tester.expectEvent(event);
  32. }
  33. }
  34. aspect A {
  35. after() throwing (Object o) : call(void C.run()) {
  36. U.e("after() throwing (Object o) : call(void C.run())");
  37. }
  38. }