Bug 33635 - Negation of if pointcut does not work
Summary: Negation of if pointcut does not work
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows NT
: P1 critical (vote)
Target Milestone: ---   Edit
Assignee: Jim Hugunin CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-03-02 20:01 EST by Ramnivas Laddad CLA
Modified: 2003-03-05 16:48 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.