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.

DecwClassCastException.java 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 DecwClassCastException {
  25. declare warning : if(true) : "if(true) directly against checker";
  26. pointcut p(): if(false);
  27. declare warning : p() : "if(false) through defined pointcut";
  28. declare error : cflow(execution(* main(..))): "cflow(execution(* main(..))) directly against checker";
  29. pointcut p2(): cflow(execution(* main(..)));
  30. declare error : p2() : "cflow(execution(* main(..))) through defined pointcut";
  31. declare warning : cflowbelow(execution(* main(..))): "cflowbelow(execution(* main(..))) directly against checker";
  32. pointcut p3(): cflowbelow(execution(* main(..)));
  33. declare error : p3() : "cflowbelow(execution(* main(..))) through defined pointcut";
  34. declare warning : this(Object): "this(Object) directly against checker";
  35. pointcut p4(): this(Object);
  36. declare warning : p4(): "this(Object) through defined pointcut";
  37. declare warning : target(Object): "target(Object) directly against checker";
  38. pointcut p5(): target(Object);
  39. declare warning : p5(): "target(Object) through defined pointcut";
  40. declare warning : args(Object): "args(Object) directly against checker";
  41. pointcut p6(): args(Object);
  42. declare warning : p6(): "args(Object) through defined pointcut";
  43. public static void main(String[] args) {
  44. System.err.println("In main!");
  45. }
  46. }