private static void replaceAssignmentsWithStringBuilder(PsiVariable variable, PsiJavaCodeReferenceElement stringBuilderClassReference) {
      final List<PsiReferenceExpression> references = VariableAccessUtils.getVariableReferences(variable);
      for (PsiReference reference : references) {
        final PsiElement referenceElement = PsiUtil.skipParenthesizedExprUp(reference.getElement().getParent());
        if (referenceElement instanceof PsiAssignmentExpression assignmentExpression) {
          final PsiExpression rhs = assignmentExpression.getRExpression();
          final PsiExpression newExpression = getNewStringBuffer(rhs);
          if (!(newExpression instanceof PsiNewExpression)) {
            continue;
          }
          final PsiJavaCodeReferenceElement classReference = ((PsiNewExpression)newExpression).getClassReference();
          if (classReference == null) {
            continue;
          }
          classReference.replace(stringBuilderClassReference);
        }
      }
    }
private static void replaceAssignmentsWithStringBuilder(PsiVariable variable, PsiJavaCodeReferenceElement stringBuilderClassReference)