IDEA-181667 Always true assert is reported when expression is parenthesised

This commit is contained in:
Tagir Valeev
2017-11-07 11:21:15 +07:00
parent 81ea1450e1
commit 5c25b28ec0
2 changed files with 5 additions and 1 deletions
@@ -706,7 +706,7 @@ public class DataFlowInspectionBase extends AbstractBaseJavaLocalInspectionTool
}
private static boolean isAssertionEffectively(PsiElement psiAnchor, boolean evaluatesToTrue) {
PsiElement parent = psiAnchor.getParent();
PsiElement parent = PsiUtil.skipParenthesizedExprUp(psiAnchor.getParent());
if (parent instanceof PsiAssertStatement) {
return evaluatesToTrue;
}
@@ -5,6 +5,10 @@ class Test {
assert foo != null;
}
private static void testParens(@NotNull Object foo) {
assert (foo != null);
}
private static void test2(@NotNull Object foo) {
if (foo == null) {
throw new IllegalArgumentException();