From 388f843989d924ce3e8831bc987c6eeb04ffc6df Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Fri, 17 Jun 2011 14:36:48 +0200 Subject: [PATCH] handle parentheses in "Boolean variable is always inverted" inspection --- .../ig/dataflow/BooleanVariableAlwaysNegatedInspection.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/dataflow/BooleanVariableAlwaysNegatedInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/dataflow/BooleanVariableAlwaysNegatedInspection.java index 8307a35bfb1f..f4c645761071 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/dataflow/BooleanVariableAlwaysNegatedInspection.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/dataflow/BooleanVariableAlwaysNegatedInspection.java @@ -166,7 +166,10 @@ public class BooleanVariableAlwaysNegatedInspection extends BaseInspection { return; } read = true; - final PsiElement parent = expression.getParent(); + PsiElement parent = expression.getParent(); + while (parent instanceof PsiParenthesizedExpression) { + parent = parent.getParent(); + } if (!(parent instanceof PsiPrefixExpression)) { alwaysNegated = false; return;