PsiExpression (@NotNull PsiExpression expression) { PsiElement parent = PsiUtil.skipParenthesizedExprUp(expression.getParent()); if (parent instanceof PsiBinaryExpression binOp && ComparisonUtils.isEqualityComparison(binOp)) { PsiExpression leftOperand = PsiUtil.skipParenthesizedExprDown(binOp.getLOperand()); PsiExpression rightOperand = PsiUtil.skipParenthesizedExprDown(binOp.getROperand()); return PsiTreeUtil.isAncestor(leftOperand, expression, false) ? rightOperand : leftOperand; } if (parent instanceof PsiExpressionList && parent.getParent() instanceof PsiMethodCallExpression call && MethodCallUtils.isEqualsCall(call)) { return PsiUtil.skipParenthesizedExprDown(call.getMethodExpression().getQualifierExpression()); } PsiMethodCallExpression call = getCallForQualifier(expression); if (call != null && MethodCallUtils.isEqualsCall(call)) { return PsiUtil.skipParenthesizedExprDown(ArrayUtil.getFirstElement(call.getArgumentList().getExpressions())); } return null; }