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

1234567891011121314151617181920212223242526272829
  1. import org.aspectj.testing.Tester;
  2. // PR#285 cflow advice with no source
  3. public class Driver {
  4. public static String s = "";
  5. public static void main(String[] args){ test(); }
  6. public static void test() {
  7. new Driver().go();
  8. Tester.checkEqual(s, "-go-advised", "advice runs");
  9. }
  10. int go(){
  11. s += "-go";
  12. return Math.max(1, 3);
  13. }
  14. }
  15. aspect A of eachcflow(instanceof(Driver) && executions(* go(..))) {
  16. before (): calls(* Math.*(..)) && ! calls(* Driver.go()) && ! calls(* Driver.test()) {
  17. Driver.s += "-advised";
  18. }
  19. }