Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 23261

Summary: "Invert boolean" [refactoring] [quick assist]
Product: [Eclipse Project] JDT Reporter: Magnus Ihse Bursie <magnus.ihse.bursie>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: RESOLVED WONTFIX QA Contact:
Severity: enhancement    
Priority: P3 CC: akiezun
Version: 2.0Keywords: helpwanted
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Magnus Ihse Bursie CLA 2002-09-06 07:24:45 EDT
Often, you find that you have defined the boolean to default to the "wrong" 
state. Like in this code snippet:
boolean isClosed = false;
while (!isClosed) {
  // process
}

In this case, the code would be more easy to read if it was changed to
boolean isOpen = true;
while (isOpen) {
  // process
}

This code is of course very simple, but in more complex systems this kind of 
change can be of significant help.

The refactoring should do the following: ask for a new name for the boolean 
variable, and invert (and of course simplify) all expressions with this 
variable.
Comment 1 Adam Kiezun CLA 2002-09-06 07:57:58 EDT
see also bug 23087
Comment 2 Dirk Baeumer CLA 2002-09-06 11:23:54 EDT
Time permitted for 2.1
Comment 3 Dirk Baeumer CLA 2003-04-24 12:11:03 EDT
could be a quick assist as well.
Comment 4 Dirk Baeumer CLA 2003-04-28 06:04:06 EDT
Chaning state from assigned later to resolved later. Assigned later got 
introduced by the last bug conversion and is not a supported Eclipse bug state.
Comment 5 Eclipse Webmaster CLA 2009-08-30 02:39:59 EDT
As of now 'LATER' and 'REMIND' resolutions are no longer supported.
Please reopen this bug if it is still valid for you.