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

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // various forms of package name pattern matching work
  2. import org.aspectj.testing.Tester;
  3. import p1.C1;
  4. import p1.p2.C2;
  5. public class Driver {
  6. public static void test() {
  7. Top t = new Top();
  8. p1.C1 c1 = new p1.C1();
  9. p1.p2.C2 c2 = new p1.p2.C2();
  10. Tester.checkEqual(t.bar(), 11, "top.bar()");
  11. Tester.checkEqual(c1.bar(), 1111, "c1.bar()");
  12. Tester.checkEqual(c2.bar(), 1011, "c2.bar()");
  13. }
  14. public static void main(String[] args) { test(); }
  15. }
  16. class Top {
  17. public int bar() {
  18. return 1;
  19. }
  20. }
  21. aspect TopAdvice {
  22. int around(): target(*) && call(int *()) {
  23. int result = proceed();
  24. return result+10;
  25. }
  26. int around(): call(int p1.*.*()) {
  27. int result = proceed();
  28. return result+100;
  29. }
  30. int around(): call(int p1..*.*()) {
  31. int result = proceed();
  32. return result+1000;
  33. }
  34. }