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.

CflowAlone.java 1.1KB

123456789101112131415161718192021222324252627282930
  1. import org.aspectj.testing.Tester;
  2. import org.aspectj.testing.Tester;
  3. public class CflowAlone {
  4. public static void main(String[] args){
  5. new testclass1();
  6. Tester.check(0 < Filteraspect.i,
  7. "0 < Filteraspect.i: " + Filteraspect.i);
  8. }
  9. }
  10. class testclass1 {}
  11. class testclass2 {}
  12. aspect Filteraspect {
  13. static int i;
  14. // all these variants fail
  15. //pointcut goCut(): cflow(this(testclass2));
  16. //pointcut goCut(): cflow(target(testclass2));
  17. //pointcut goCut(): cflow(args(testclass2));
  18. //pointcut goCut(): cflow(!within(FilterAspect));
  19. //pointcut goCut(): cflow(within(FilterAspect));
  20. //pointcut goCut(): cflow(within(testclass1));
  21. pointcut goCut(): !within(Filteraspect) && cflow(within(testclass1))
  22. && !preinitialization(new(..)) && !initialization(new(..));
  23. // works ok
  24. //pointcut goCut(): within(Filteraspect);
  25. Object around(): goCut() { i++; return proceed(); }
  26. // no bug when using before or after
  27. //after(): goCut() { int i = 1; System.getProperties().put("foo", "bar");}
  28. }