Bug 225883

Summary: [quick assist] Simplify boolean expressions with redundancy
Product: [Eclipse Project] JDT Reporter: Erkki Lindpere <villane>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: ASSIGNED --- QA Contact:
Severity: enhancement    
Priority: P3 CC: b.muskalla, martinae, Olivier_Thomann
Version: 3.4Keywords: helpwanted
Target Milestone: ---   
Hardware: All   
OS: All   
URL: http://thedailywtf.com/Articles/The-Test-of-Truth.aspx
Whiteboard:

Description Erkki Lindpere CLA 2008-04-05 16:27:14 EDT
Granted, these don't happen often, but it would be helpful if Eclipse could assist simplifying complex boolean expressions that have redundant checks. For example this from http://thedailywtf.com/Articles/The-Test-of-Truth.aspx : 

return (test == true)? ( (test == false)? false : true) : ((test == false) ? false : true);
// can be reduced to 'return test;'
Comment 1 Erkki Lindpere CLA 2008-04-05 16:31:29 EDT
Ideally, it should be able to simplify if-else statements as well.
Comment 2 Olivier Thomann CLA 2008-04-06 09:10:59 EDT
Move to JDT/UI
Comment 3 Martin Aeschlimann CLA 2008-04-07 05:35:49 EDT
Would make a nice project to implement for somebody interested.