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

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. }