void (@NotNull Project project, @NotNull PsiElement startElement, @NotNull ModPsiUpdater updater) { final PsiMethodCallExpression call = PsiTreeUtil.getParentOfType(startElement, PsiMethodCallExpression.class); final EqualityCheck check = EqualityCheck.from(call); if (check == null) return; final CommentTracker commentTracker = new CommentTracker(); final PsiExpression left = check.getLeft(); final PsiExpression right = check.getRight(); final String qualifierText = commentTracker.text(left, ParenthesesUtils.METHOD_CALL_PRECEDENCE); final String argText = commentTracker.text(right); @NonNls String replacement = qualifierText + ".compareTo(" + argText + ")==0"; if (!check.isLeftDereferenced() && NullabilityUtil.getExpressionNullability(left, true) != Nullability.NOT_NULL) { final boolean bothNullShouldEqual = call.getArgumentList().getExpressionCount() == 2 && NullabilityUtil.getExpressionNullability(right, true) != Nullability.NOT_NULL; replacement = bothNullShouldEqual ? left.getText() + "==null?" + right.getText() + "==null:" + replacement : left.getText() + "!=null && " + replacement; } PsiReplacementUtil.replaceExpression(call, replacement, commentTracker); }