ComparisonBlock (@Nullable PsiExpression expr, @NotNull PsiVariable firstParam, @NotNull PsiVariable secondParam, @NotNull PsiVariable variable) { PsiExpression first = null; PsiExpression second = null; if (expr instanceof PsiMethodCallExpression call) { PsiExpression[] parameters = call.getArgumentList().getExpressions(); if (PrimitiveComparison.from(call) != null) { first = parameters[0]; second = parameters[1]; } else if (MethodCallUtils.isCompareToCall(call)) { first = call.getMethodExpression().getQualifierExpression(); second = ArrayUtil.getFirstElement(call.getArgumentList().getExpressions()); } } else if (expr instanceof PsiBinaryExpression binOp) { if(binOp.getOperationTokenType() != JavaTokenType.MINUS) return null; first = binOp.getLOperand(); if(getComparingMethodName(first.getType(), true) == null) return null; second = binOp.getROperand(); } if(first == null || second == null) return null; if (!usagesAreAllowed(firstParam, secondParam, first, second)) return null; if (!keyAccessEquivalent(firstParam, secondParam, first, second)) return null; return new ComparisonBlock(second, variable); }