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.

IfPcd.java 1015B

12345678910111213141516171819202122232425262728293031323334353637
  1. public aspect IfPcd {
  2. private static int foo = 393;
  3. before(): execution(void IfPcd.main(..)) && if(foo == 393) {
  4. System.err.println("Hiya");
  5. foo++;
  6. main(null); // saved from an infinite loop by the if
  7. }
  8. before(): execution(void IfPcd.main(..)) && if(thisJoinPoint.getThis() == null) {
  9. System.err.println("!has this: "+ thisJoinPoint.getThis());
  10. }
  11. before(): execution(void IfPcd.main(..)) && if(thisJoinPointStaticPart.getKind() == "method-execution") {
  12. System.err.println("is method-exec");
  13. }
  14. before(Object o): execution(void IfPcd.main(..)) && args(o) && if(o != null) {
  15. System.err.println("got: " + o);
  16. }
  17. pointcut fun(Object o): args(o) && if(o != null);
  18. before(Object o1, Object o2): execution(void IfPcd.main(..)) && args(o1) && fun(o2) {
  19. System.err.println("got: " + o2);
  20. }
  21. before(): execution(void IfPcd.main(..)) && fun(Object) {
  22. System.err.println("got nothin");
  23. }
  24. public static void main(String[] args) {
  25. System.err.println("actual body: " + args);
  26. }
  27. }