eclipse-aspectj / aspectj

Other
304 stars 86 forks source link

negating an if() with annotation style doesn't work #122

Closed aclement closed 2 years ago

aclement commented 2 years ago

Quite surprised by this. This aspect works as expected:

@Aspect class Azpect {
    @Pointcut("bar()") public static void foo() {}
    @Pointcut("if()") public static boolean bar() { return true; }
    @Before("foo() && execution(* E.run(..))") public void beforeAdvice() {
        System.out.println("advice running");
    }
}

Inverting the if() return value and switching it to !bar():

@Aspect class Azpect {
    @Pointcut("!bar()") public static void foo() {}
    @Pointcut("if()") public static boolean bar() { return false; }
    @Before("foo() && execution(* E.run(..))") public void beforeAdvice() {
        System.out.println("advice running");
    }
}

and it doesn't work any more.