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.

AmbiguousBindings.aj 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // pushes the limits of what ajc will accept as an unambiguous binding...
  2. aspect AmbiguousBindings {
  3. pointcut p1(Foo foo) : (call(* *(..)) && this(foo)) || (execution(* *(..)) && args(foo));
  4. pointcut p2(Foo foo) : (call(* m(..)) && this(foo)) || (call(* n(..)) && args(foo));
  5. pointcut p3(Foo foo) : (execution(* *(int,int)) && this(foo)) || (execution(* *(int)) && this(foo));
  6. pointcut p4(Foo foo) : (get(int a) && this(foo)) || (get(int b) && target(foo));
  7. pointcut p5(int x) : (set(int a) && args(x)) || (set(int b) && args(x));
  8. pointcut p6(Foo foo) : (within(Foo) && this(foo)) || (within(AmbiguousBindings) && args(foo));
  9. pointcut q1(Foo foo) : (call(* m(..)) && this(foo)) || (call(* m*(..)) && args(foo));
  10. pointcut q2(Foo foo) : (execution(* *(int,int)) && this(foo)) || (execution(* *(int,*)) && args(foo));
  11. pointcut q3(Foo foo) : (get(int a) && this(foo)) || (get(int a) && target(foo));
  12. pointcut q4(int x) : (set(int a) && args(x)) || (set(* *) && this(x));
  13. pointcut q5(Foo foo) : (within(Foo) && this(foo)) || (within(F*) && args(foo));
  14. // these should be good
  15. before(Foo foo) : p1(foo) {}
  16. before(Foo foo) : p2(foo) {}
  17. before(Foo foo) : p3(foo) {}
  18. before(Foo foo) : p4(foo) {}
  19. before(int z) : p5(z) {}
  20. before(Foo foo) : p6(foo) {}
  21. // these are all ambiguous
  22. before(Foo foo) : q1(foo) {}
  23. before(Foo foo) : q2(foo) {}
  24. before(Foo foo) : q3(foo) {}
  25. before(int x) : q4(x) {}
  26. before(Foo foo) : q5(foo) {}
  27. }
  28. class Foo {
  29. int a;
  30. int b;
  31. public void m(int x, int y) {
  32. a = y;
  33. n(x);
  34. }
  35. public void n(int x) {
  36. b = x;
  37. a = a * 2;
  38. }
  39. }