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.

ConstructorExecInit.java 698B

1234567891011121314151617181920212223242526
  1. import org.aspectj.testing.*;
  2. /**
  3. * -usejavac mode: no error
  4. * not -usejavac mode: VerifyError
  5. */
  6. public class ConstructorExecInit {
  7. public static void main(String[] args) {
  8. new ConstructorExecInit();
  9. Tester.checkAllEvents();
  10. }
  11. static {
  12. Tester.expectEvent("execution");
  13. Tester.expectEvent("initialization");
  14. }
  15. }
  16. /** @testcase after returning from initialization and after executing constructor */
  17. aspect A {
  18. after (Object target) : execution(*.new(..)) && target(target) && !within(A) {
  19. Tester.event("execution");
  20. }
  21. after () returning : initialization(new(..)) && !this(A) {
  22. Tester.event("initialization");
  23. }
  24. }