@Override
  public void invoke(@NotNull Project project,
                     @NotNull PsiFile file,
                     Editor editor,
                     @NotNull PsiElement startElement,
                     @NotNull PsiElement endElement) {
    final PsiMethod method = (PsiMethod)startElement;

    if (!FileModificationService.getInstance().prepareFileForWrite(method.getContainingFile())) return;
    PsiType newType = myReturnTypePointer.getType();
    if (newType == null) return;
    boolean isNullType = TypeConversionUtil.isNullType(newType);
    PsiType returnType = isNullType ? PsiType.getJavaLangObject(method.getManager(), method.getResolveScope()) : newType;
    PsiTypeElement typeElement = method.getReturnTypeElement();
    if (typeElement == null) {
      WriteCommandAction.runWriteCommandAction(project, QuickFixBundle.message("fix.return.type.family"), null,
                                               () -> addReturnType(project, method, returnType));
      PsiDocumentManager.getInstance(project).doPostponedOperationsAndUnblockDocument(editor.getDocument());
    }
    PsiType[] superTypes = mySuggestSuperTypes ? returnType.getSuperTypes() : PsiType.EMPTY_ARRAY;
    if ((!isNullType && superTypes.length == 0) || editor == null || ApplicationManager.getApplication().isUnitTestMode()) {
      changeReturnType(project, file, editor, method, returnType);
    }
    else {
      Set<PsiType> allSuperTypes = collectSuperTypes(returnType, startElement, new LinkedHashSet<>());
      List<PsiType> returnTypes = getReturnTypes(allSuperTypes.toArray(PsiType.EMPTY_ARRAY), returnType);
      final PsiType currentType = method.getReturnType();
      assert currentType != null;
      returnTypes.removeIf(e -> e.getCanonicalText().equals(currentType.getCanonicalText()));
      if (returnTypes.isEmpty()) return;
      selectReturnType(project, file, editor, returnTypes, returnType, method);
    }
  }
@Override
  public void invoke(@NotNull Project project,
                     @NotNull PsiFile file,
                     Editor editor,
                     @NotNull PsiElement startElement,
                     @NotNull PsiElement endElement)