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.

AfterAdviceOnConstructorsOnTheWrongType.java 816B

1234567891011121314151617181920212223242526272829
  1. import org.aspectj.testing.Tester;
  2. public class AfterAdviceOnConstructorsOnTheWrongType {
  3. public static void main(String[] args) {
  4. new AfterAdviceOnConstructorsOnTheWrongType().realMain(args);
  5. }
  6. public void realMain(String[] args) {
  7. new C().c();
  8. new D().d();
  9. Tester.checkAllEvents();
  10. }
  11. static {
  12. Tester.clearEvents();
  13. // new(..) for just class
  14. Tester.expectEventsInString("after-c,c,after-d,d");
  15. }
  16. }
  17. interface I {}
  18. class C implements I { public void c() { Tester.event("c"); } }
  19. class D implements I { public void d() { Tester.event("d"); } }
  20. aspect A {
  21. after(C c): target(c) && execution(new(..)) {
  22. Tester.event("after-c");
  23. }
  24. after(D d): target(d) && execution(new(..)) {
  25. Tester.event("after-d");
  26. }
  27. }