boolean (@Nullable PsiExpression condition, boolean ignoreNegatedNullComparison, boolean ignoreNegatedZeroComparison) { condition = PsiUtil.skipParenthesizedExprDown(condition); if (condition instanceof final PsiPrefixExpression prefixExpression) { final IElementType tokenType = prefixExpression.getOperationTokenType(); return tokenType.equals(JavaTokenType.EXCL); } else if (condition instanceof final PsiBinaryExpression binaryExpression) { final PsiExpression lhs = PsiUtil.skipParenthesizedExprDown(binaryExpression.getLOperand()); final PsiExpression rhs = PsiUtil.skipParenthesizedExprDown(binaryExpression.getROperand()); if (lhs == null || rhs == null) { return false; } final IElementType tokenType = binaryExpression.getOperationTokenType(); if (tokenType.equals(JavaTokenType.NE)) { if (ignoreNegatedNullComparison) { final String lhsText = lhs.getText(); final String rhsText = rhs.getText(); if (PsiKeyword.NULL.equals(lhsText) || PsiKeyword.NULL.equals(rhsText)) { return false; } } return !(ignoreNegatedZeroComparison && (isZeroLiteral(lhs) || isZeroLiteral(rhs))); } } return false; }