New Parse Error in IDEA 5.0.1

All,

I'm getting warnings for the following types of lines of code:

if (allowChanges() == false) {

Where the warning is: "allowChanges() == false can be simplied to !allowChanges()"

First of all, I completley disagree with this notion. We enforce strict coding guidelines for our developers where we specifically enjoin this form of the expression. The number of times I have looked quickly at a line of code in an if block like the following:

if(!allowChanges())

and didn't happen to catch the negation is more than I care to count.

Regardless of my feelings on this issue, I can't figure out how to turn off this warning. I have filtered the warnings in the Errors section of Settings using the word 'simplified'. I get a bunch of hits for the Control Flow category (all of which are on by default) and one for the Class Structure category. Even when I uncheck all of the boxes, apply the changes, and quit and restart IDEA, I still get the warning above. What am I missing?

Regards,
Paul

2 comments
Comment actions Permalink

Paul wrote:

The number of times I have looked quickly at a line of
code in an if block like the following:

if(!allowChanges())

and didn't happen to catch the negation is more than I care to count.


A partial solution to this might be to enable "Conditional expression with
negated condition" and "If statement with negated condition" inspections.

Regardless of my feelings on this issue, I can't figure out how to turn off
this warning. I have filtered the warnings in the Errors section of Settings
using the word 'simplified'. I get a bunch of hits for the Control Flow
category (all of which are on by default) and one for the Class Structure
category. Even when I uncheck all of the boxes, apply the changes, and quit
and restart IDEA, I still get the warning above. What am I missing?


You can always edit a warning/error's options by pressing Alt+enter (or clicking
the lightbulb) then pressing the right arrow. Anyway this error is called
"Pointless boolean expression."

0
Comment actions Permalink

"Pointless boolean expression" in the Control Flow category is what you're looking for.

Sascha

0

Please sign in to leave a comment.