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.

D.java 737B

123456789101112131415161718192021222324252627282930313233
  1. import org.aspectj.lang.annotation.Aspect;
  2. import org.aspectj.lang.annotation.Before;
  3. import org.aspectj.lang.annotation.Pointcut;
  4. /**
  5. * This test is exploring situations where an if() pointcut is used with a parameter
  6. * and yet a reference pointcut referring to it is not binding the parameter.
  7. */
  8. public class D {
  9. public static void main(String []argv) {
  10. new D().run();
  11. }
  12. public void run() {
  13. System.out.println("D.run() executing");
  14. }
  15. public boolean isTrue() {
  16. return true;
  17. }
  18. }
  19. @Aspect class Azpect {
  20. @Pointcut("this(d) && if()") public static boolean method(D d) { return d.isTrue(); }
  21. @Before("method(*) && execution(* D.run(..))") public void beforeAdvice() {
  22. System.out.println("advice running");
  23. }
  24. }