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.

Driver.java 776B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import org.aspectj.testing.Tester;
  2. // PR#211
  3. public class Driver {
  4. public static String s = "s";
  5. public static void main(String[] args) { test(); }
  6. public static void test() {
  7. doIt();
  8. Tester.checkEqual(s, "s:a:b", "both advice worked");
  9. }
  10. public static String doIt() {
  11. return s;
  12. }
  13. }
  14. aspect Outer {
  15. static int N = 10;
  16. pointcut staticMeth(): within(Driver) && execution(String doIt());
  17. static aspect Inner {
  18. static void foo() {
  19. int i = N;
  20. }
  21. before(): staticMeth() {
  22. Driver.s += ":b";
  23. }
  24. pointcut innerPoints(): within(Driver) && execution(void test());
  25. }
  26. before(): Outer.Inner.innerPoints() {
  27. Driver.s += ":a";
  28. }
  29. }