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.

PR347.java 824B

12345678910111213141516171819202122232425262728293031323334353637
  1. import org.aspectj.testing.*;
  2. public class PR347 {
  3. public static void main(String[] args) {
  4. new PR347().realMain(args);
  5. }
  6. public void realMain(String[] args) {
  7. new A().i();
  8. new B().j();
  9. Tester.checkAllEvents();
  10. }
  11. static {
  12. Tester.expectEventsInString("Ai,A.i,Bj,B.j");
  13. }
  14. }
  15. interface I { public void i(); }
  16. interface J { public void j(); }
  17. class A {}
  18. class B {}
  19. aspect Aspect1 {
  20. A +implements I;
  21. B +implements J;
  22. }
  23. aspect Aspect2 {
  24. pointcut Ai(): receptions(void i()) && instanceof(A);
  25. pointcut Bj(): receptions(void j()) && instanceof(B);
  26. before(): Ai() { Tester.event("Ai"); }
  27. before(): Bj() { Tester.event("Bj"); }
  28. }
  29. aspect Aspect3 {
  30. public void A.i() { Tester.event("A.i"); }
  31. public void B.j() { Tester.event("B.j"); }
  32. }