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.

Bug.java 400B

123456789101112131415161718192021
  1. import org.aspectj.lang.annotation.*;
  2. public @Aspect class Bug {
  3. @Pointcut("args(i) && if() && within(Foo)")
  4. public static boolean pc(int i) {
  5. return i < 0;
  6. }
  7. @Before("pc(*)")
  8. public void advice() { System.out.println("advice running");}
  9. public static void main(String []argv) {
  10. new Foo().trigger(-1);
  11. new Foo().trigger(+1);
  12. }
  13. }
  14. class Foo {
  15. public void trigger(int i) {}
  16. }