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.

DeclareSoftDynamicPCDs.java 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * From:
  3. *
  4. * http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/aspectj-home/doc/progguide/semantics-declare.html#d0e6499
  5. *
  6. * Pointcuts that appear inside of declare forms have certain restrictions.
  7. * Like other pointcuts, these pick out join points, but they do so in a
  8. * way that is statically determinable.
  9. *
  10. * Consequently, such pointcuts may not include, directly or indirectly
  11. * (through user-defined pointcut declarations) pointcuts that discriminate
  12. * based on dynamic (runtime) context. Therefore, such pointcuts may not be
  13. * defined in terms of
  14. *
  15. * cflow
  16. * cflowbelow
  17. * this
  18. * target
  19. * args
  20. * if
  21. *
  22. * all of which can discriminate on runtime information.
  23. */
  24. public aspect DeclareSoftDynamicPCDs {
  25. declare soft : MyException:if(true) ;
  26. pointcut p(): if(false);
  27. declare soft : MyException: p() ;
  28. declare soft : MyException:cflow(execution(* main(..)));
  29. pointcut p2(): cflow(execution(* main(..)));
  30. declare soft : MyException:p2();
  31. declare soft : MyException:cflowbelow(execution(* main(..)));
  32. pointcut p3(): cflowbelow(execution(* main(..)));
  33. declare soft : MyException:p3();
  34. declare soft : MyException: this(Object);
  35. pointcut p4(): this(Object);
  36. declare soft : MyException:p4();
  37. declare soft : MyException:target(Object);
  38. pointcut p5(): target(Object);
  39. declare soft : MyException:p5();
  40. declare soft : MyException:args(Object);
  41. pointcut p6(): args(Object);
  42. declare soft : MyException:p6();
  43. class MyException extends Exception {
  44. }
  45. public static void main(String[] args) {
  46. System.err.println("In main!");
  47. }
  48. }