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.

Finals.java 952B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import org.aspectj.testing.*;
  2. public class Finals {
  3. public static void main(String[] args) {
  4. new Finals().go(args);
  5. Tester.checkAllEvents();
  6. }
  7. static {
  8. Tester.expectEventsInString("go,i1,i2");
  9. }
  10. void go(String[] args) {
  11. Tester.event("go");
  12. }
  13. }
  14. interface I {
  15. public void i();
  16. }
  17. aspect Aspect {
  18. pointcut p1(): call(void go(..)) && target(Finals);
  19. void around(): p1() {
  20. new I() {
  21. public void i() {
  22. a("i1");
  23. proceed();
  24. }
  25. }.i();
  26. }
  27. pointcut p2(String[] argss): call(void go(String[])) && args(argss) && target(Finals);
  28. void around(final String[] argss): p2(argss) {
  29. new I() {
  30. public void i() {
  31. a("i2");
  32. proceed(argss);
  33. }
  34. }.i();
  35. }
  36. static void a(String s) { Tester.event(s); }
  37. }