Bug 33635

Summary: Negation of if pointcut does not work
Product: [Tools] AspectJ Reporter: Ramnivas Laddad <ramnivas>
Component: CompilerAssignee: Jim Hugunin <jim-aj>
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: P1    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows NT   
Whiteboard:

Description Ramnivas Laddad CLA 2003-03-02 20:01:54 EST
In "!if(expression)" the negation part is ignored. I am using beta4.

How to reproduce:

public class Test {
    public static void main(String args[]) {
    }
}

aspect NotIfBugAspect {
    before() : execution(* main(..)) && !if(true) {
	System.out.println("NotIfBugAspect message");
    }
}

> ajc *.java
> java Test
NotIfBugAspect message

If I change the pointcut in before advice to move negation inside if(), 
everything works fine:
aspect NotIfBugAspect {
    before() : execution(* main(..)) && if(!true) {
	System.out.println("NotIfBugAspect message");
    }
}

> ajc *.java
> java Test
  <no output>
Comment 1 Jim Hugunin CLA 2003-03-05 16:48:19 EST
fixed in tree, test in bugs/NotIf.java

This bug was caused by a previous fix for handling the interaction between 
args and if pcd's.  This interaction is much messier than it should be and
is a prime opportunity for a better design.