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.

BindingArgumentsInWithincode.java 717B

1234567891011121314151617181920212223242526272829303132
  1. import java.util.*;
  2. /**
  3. * PR#479
  4. * A variant of Hunter Kelly's bug PR#479. This
  5. * doesn't get his desired, but should compile.
  6. */
  7. public class BindingArgumentsInWithincode {
  8. public static void main(String[] args) {
  9. org.aspectj.testing.Tester.check(true, "compiled");
  10. }
  11. }
  12. class C {
  13. public void someMethod(String s) {
  14. new ArrayList().add(s+":"+s);
  15. }
  16. }
  17. aspect A {
  18. pointcut top(String s):
  19. withincode(void someMethod(String)) && args(s);
  20. pointcut method(Object o):
  21. call(* java.util.List.add(Object)) && args(o);
  22. /*
  23. * Won't capture what we're after
  24. * but it should compile
  25. */
  26. before(String s, Object o): top(s) && method(o) {}
  27. }