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.

AdviceOnAdviceRecursion.java 680B

1234567891011121314151617181920212223242526272829303132
  1. import org.aspectj.testing.*;
  2. /** PR#745 stack overflow expected when advice recurses into itself */
  3. public class AdviceOnAdviceRecursion { // XXX n-aspect variant?
  4. public static void main (String[] args) {
  5. boolean passed = false;
  6. Throwable ex = null;
  7. try {
  8. C.m();
  9. } catch (StackOverflowError e) {
  10. passed = true;
  11. } catch (Throwable e) {
  12. ex = e;
  13. }
  14. Tester.check(passed, "expected StackOverflowError, got " + ex);
  15. }
  16. }
  17. class C {
  18. static void m() { ; }
  19. }
  20. aspect A {
  21. before() : within(C) || within(B) {
  22. C.m();
  23. }
  24. }
  25. aspect B {
  26. before() : call(void m()) { }
  27. }