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.

Basic3c.java 696B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import org.aspectj.lang.annotation.*;
  2. public class Basic3c {
  3. public static void main(String []argv) {
  4. Basic3c b = new Basic3c();
  5. if (!(b instanceof X.I)) throw new RuntimeException("Basic3c should implement I");
  6. ((X.I)b).m2();
  7. ((X.I)b).m3();
  8. ((X.I)b).m2();
  9. ((X.I)b).m4();
  10. }
  11. }
  12. @Aspect class X {
  13. interface I {
  14. public void m2();
  15. public void m3();
  16. public void m4();
  17. }
  18. static class IImpl implements I {
  19. private IImpl() {}
  20. public void m2() { }
  21. public void m3() { }
  22. public void m4() { }
  23. }
  24. @DeclareParents(value="Basic3c",defaultImpl=IImpl.class)
  25. private I simplefield;
  26. @Before("call(* *(..))")
  27. public void advice1() {}
  28. }