boolean (PsiExpression condition, List<ExceptionProblem> problems, boolean negated) { condition = PsiUtil.skipParenthesizedExprDown(condition); if (condition == null) return false; if (BoolUtils.isNegation(condition)) { return isConditionNecessary(BoolUtils.getNegated(condition), problems, !negated); } if (condition instanceof PsiPolyadicExpression) { IElementType type = ((PsiPolyadicExpression)condition).getOperationTokenType(); if((type.equals(JavaTokenType.ANDAND) && !negated) || (type.equals(JavaTokenType.OROR) && negated)) { for (PsiExpression operand : ((PsiPolyadicExpression)condition).getOperands()) { if (isConditionNecessary(operand, problems, negated)) { return true; } } return false; } if((type.equals(JavaTokenType.ANDAND) && negated) || (type.equals(JavaTokenType.OROR) && !negated)) { for (PsiExpression operand : ((PsiPolyadicExpression)condition).getOperands()) { if (!isConditionNecessary(operand, problems, negated)) { return false; } } return true; } } for (ExceptionProblem problem : problems) { if (problem.isNecessaryCheck(condition, negated)) { return true; } } return false; }