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 925B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import org.aspectj.testing.Tester;
  2. public aspect Driver {
  3. static boolean t1, t2, t3, t4;
  4. public static void main(String[] args) { test(); }
  5. public static void test() {
  6. Foo f1 = new Foo();
  7. f1.m1("foo");
  8. f1.m2(1);
  9. f1.m3("foo");
  10. f1.m3(1);
  11. Tester.check(t1, "finding m1(String)");
  12. Tester.check(t2, "finding m2(int)");
  13. Tester.check(t3, "finding m3(String)");
  14. Tester.check(t4, "finding m3(int)");
  15. }
  16. before(String x): target(Foo) && call(void m1(String)) && args(x) {
  17. t1 = true;
  18. }
  19. before(int x): target(Foo) && call(void m2(int)) && args(x) {
  20. t2 = true;
  21. }
  22. before(String x): target(Foo) && call(void m3(String)) && args(x) {
  23. t3 = true;
  24. }
  25. before(int x): target(Foo) && call(void m3(int)) && args(x) {
  26. t4 = true;
  27. }
  28. }
  29. class Foo {
  30. void m1(String x) { }
  31. void m2(int x) { }
  32. void m3(String x) { }
  33. void m3(int x) { }
  34. }