private void fixContainingMethodReturnType(PsiReferenceExpression referenceExpression, @NotNull ModPsiUpdater updater) {
    final PsiMethod method = PsiTreeUtil.getParentOfType(referenceExpression, PsiMethod.class, true, PsiLambdaExpression.class);
    if (method == null) {
      return;
    }
    final PsiTypeElement returnTypeElement = method.getReturnTypeElement();
    if (returnTypeElement == null) {
      return;
    }
    final PsiType type = returnTypeElement.getType();
    if (!InheritanceUtil.isInheritor(type, myQualifiedClassName)) {
      return;
    }
    if (!(type instanceof PsiClassType classType)) {
      return;
    }
    final Project project = referenceExpression.getProject();
    final PsiClass aClass = classType.resolve();
    if (aClass == null || myQualifiedClassName.equals(aClass.getQualifiedName())) {
      return;
    }
    final PsiType[] parameters = classType.getParameters();
    final PsiElementFactory factory = JavaPsiFacade.getElementFactory(project);
    final String typeText;
    if (parameters.length > 0) {
      final StringBuilder builder = new StringBuilder(myQualifiedClassName);
      builder.append('<');
      boolean comma = false;
      for (PsiType parameter : parameters) {
        if (comma) {
          builder.append(',');
        }
        else {
          comma = true;
        }
        builder.append(parameter.getCanonicalText());
      }
      builder.append('>');
      typeText = builder.toString();
    }
    else {
      typeText = myQualifiedClassName;
    }
    final PsiTypeElement newTypeElement = factory.createTypeElementFromText(typeText, referenceExpression);
    final PsiElement replacement = returnTypeElement.replace(newTypeElement);
    final JavaCodeStyleManager javaCodeStyleManager = JavaCodeStyleManager.getInstance(project);
    javaCodeStyleManager.shortenClassReferences(replacement);
    updater.highlight(replacement);
  }
private void fixContainingMethodReturnType(PsiReferenceExpression referenceExpression, @NotNull ModPsiUpdater updater)