ThreeState (@NotNull PsiStatement statement) { PsiIfStatement ifStatement = tryCast(statement, PsiIfStatement.class); if (ifStatement == null) return ThreeState.UNSURE; PsiExpression condition = ifStatement.getCondition(); if (condition == null) return ThreeState.UNSURE; boolean negated = BoolUtils.isNegation(condition); condition = PsiUtil.skipParenthesizedExprDown(condition); PsiExpression expression = negated ? BoolUtils.getNegated(condition) : condition; PsiLocalVariable boolFlagVar = resolveLocalVariable(expression); if(boolFlagVar == null) return ThreeState.UNSURE; return ThreeState.fromBoolean(ExpressionUtils.isLiteral(PsiUtil.skipParenthesizedExprDown(boolFlagVar.getInitializer()), !negated)); }