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.

AfterReturningInterfaceConstructorCE.java 744B

123456789101112131415161718192021222324252627282930313233
  1. import org.aspectj.testing.Tester;
  2. /** @testcase PR#889 after returning advice on interface constructor */
  3. public class AfterReturningInterfaceConstructorCE {
  4. public static void main (String[] args) {
  5. Tester.expectEvent("constructor");
  6. Tester.expectEvent("advice");
  7. I i = new C();
  8. System.out.println("i.i: " + i.i);
  9. Tester.checkAllEvents();
  10. }
  11. }
  12. interface I {}
  13. class C implements I {
  14. C() {
  15. Tester.event("constructor");
  16. }
  17. }
  18. aspect A {
  19. int I.i;
  20. I.new() {
  21. i = 2;
  22. System.out.println("running I.new()");
  23. }
  24. after() returning: execution(I.new()) { // ERR: can't define constructor on interface
  25. Tester.event("advice");
  26. }
  27. }