From d8d88e543e2a238f5fb667db7a1eb0a981c85a9d Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Fri, 17 Jun 2011 14:16:45 +0200 Subject: [PATCH] handle parentheses in "'null' thrown" inspection --- .../src/com/siyeh/ig/errorhandling/NullThrownInspection.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/errorhandling/NullThrownInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/errorhandling/NullThrownInspection.java index dc329872a3d6..c17b2b2e150f 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/errorhandling/NullThrownInspection.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/errorhandling/NullThrownInspection.java @@ -23,6 +23,7 @@ import com.siyeh.InspectionGadgetsBundle; import com.siyeh.ig.BaseInspection; import com.siyeh.ig.BaseInspectionVisitor; import com.siyeh.ig.InspectionGadgetsFix; +import com.siyeh.ig.psiutils.ParenthesesUtils; import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NotNull; @@ -78,7 +79,8 @@ public class NullThrownInspection extends BaseInspection { @Override public void visitThrowStatement(PsiThrowStatement statement) { super.visitThrowStatement(statement); - final PsiExpression exception = statement.getException(); + final PsiExpression exception = + ParenthesesUtils.stripParentheses(statement.getException()); if (!(exception instanceof PsiLiteralExpression)) { return; }