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.

PR573_1.java 780B

1234567891011121314151617181920212223
  1. import org.aspectj.testing.Tester;
  2. /** @testcase PR#573 pertarget stack overflow getting name of anonymous class */
  3. public class PR573_1 {
  4. static public void main(String[] params) {
  5. final Object o1 = new Object();
  6. final Object o = new Object() {
  7. public void m() {
  8. o1.toString();
  9. }};
  10. Tester.expectEvent("A.init0");
  11. Tester.check(null != o, "null != o");
  12. o.toString(); // no exceptions
  13. Tester.check(1 == A.num, "1 == A.num: " + A.num);
  14. Tester.checkAllEvents();
  15. }
  16. }
  17. // different stack overflow when using Object, not Interface
  18. aspect A pertarget(target(Object) && !target(A)) { // was a warning in 1.0
  19. public static int num;
  20. A(){ Tester.event("A.init" + num++); }
  21. }