boolean (PsiStatement statement, PsiParameter parameter) { if (!(statement instanceof PsiIfStatement ifStatement)) return false; if (ifStatement.getElseBranch() != null) return false; if (!returnsBoolean(ifStatement.getThenBranch(), false)) return false; PsiExpression condition = PsiUtil.skipParenthesizedExprDown(ifStatement.getCondition()); if (!(condition instanceof PsiBinaryExpression disjunction) || !disjunction.getOperationTokenType().equals(JavaTokenType.OROR)) { return false; } if (ExpressionUtils.getVariableFromNullComparison(disjunction.getLOperand(), true) != parameter) return false; PsiExpression rOperand = disjunction.getROperand(); if (rOperand instanceof PsiBinaryExpression rightBinOp) { if (!rightBinOp.getOperationTokenType().equals(JavaTokenType.NE)) return false; PsiExpression left = rightBinOp.getLOperand(); PsiExpression right = rightBinOp.getROperand(); return isObjectGetClass(left, parameter) && isThisClass(right) || isObjectGetClass(right, parameter) && isThisClass(left); } if (BoolUtils.getNegated(rOperand) instanceof PsiInstanceOfExpression instanceOfExpression) { return ExpressionUtils.isReferenceTo(instanceOfExpression.getOperand(), parameter) && isCurrentType(instanceOfExpression.getCheckType()); } return false; }