private void selectReturnType(@NotNull Project project,
                                @NotNull PsiFile file,
                                @NotNull Editor editor,
                                @NotNull List<PsiType> returnTypes,
                                @NotNull PsiType myReturnType,
                                @NotNull PsiMethod myMethod) {
    PsiTypeElement typeElement = myMethod.getReturnTypeElement();
    if (typeElement == null) return;
    TemplateBuilderImpl builder = new TemplateBuilderImpl(typeElement);
    builder.replaceElement(typeElement, new TypeExpression(project, returnTypes));
    Template template = WriteCommandAction.runWriteCommandAction(project, (Computable<Template>)() -> builder.buildInlineTemplate());
    TemplateEditingAdapter listener = new TemplateEditingAdapter() {
      @Override
      public void templateFinished(@NotNull Template template, boolean brokenOff) {
        if (brokenOff) return;
        PsiType newReturnType = myMethod.getReturnType();
        if (newReturnType == null) return;
        TypeSelectorManagerImpl.typeSelected(newReturnType, myReturnType);
        changeReturnType(project, file, editor, myMethod, newReturnType);
      }
    };
    editor.getCaretModel().moveToOffset(typeElement.getTextOffset());
    TemplateManager.getInstance(project).startTemplate(editor, template, listener);
  }
private void selectReturnType(@NotNull Project project,
                                @NotNull PsiFile file,
                                @NotNull Editor editor,
                                @NotNull List<PsiType> returnTypes,
                                @NotNull PsiType myReturnType,
                                @NotNull PsiMethod myMethod)