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.

ArgsInCflowCf.java 1.0KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import org.aspectj.testing.*;
  2. /** PR#660 name binding in around cflow */
  3. public class ArgsInCflowCf {
  4. public static void main(String[] args) {
  5. Tester.check(3==foo(1), "3==foo(1)");
  6. Tester.checkAllEvents();
  7. }
  8. static int foo(int x) {return bar(x+1);}
  9. static int bar(int x) {return x+1;}
  10. static {
  11. Tester.expectEvent("1-2");
  12. }
  13. }
  14. aspect Test {
  15. int around(int x, int y) : // ERR not final
  16. cflow(call(int foo(int)) && args(x))
  17. && call(int bar(int)) && args(y) {
  18. Tester.event(x + "-" + y);
  19. return proceed(x,y);
  20. }
  21. int around(final int x, int y) :
  22. cflow(call(int foo(int)) && args(x))
  23. && call(int bar(int)) && args(y) {
  24. Tester.event(x + "-" + y);
  25. return proceed(y,y); // ERR simple refs
  26. }
  27. int around(final int x, int y) :
  28. cflow(call(int foo(int)) && args(x))
  29. && call(int bar(int)) && args(y) {
  30. Tester.event(x + "-" + y);
  31. return proceed(x+1,y+1); // ERR simple refs
  32. }
  33. }