private static void invoke(@NotNull PsiMethod method, @NotNull Project project, @Nullable final Editor editor) {
    PsiMethod newMethod = SuperMethodWarningUtil.checkSuperMethod(method);
    if (newMethod == null) return;

    if (!newMethod.equals(method)) {
      ChangeSignatureUtil.invokeChangeSignatureOn(newMethod, project);
      return;
    }

    if (!CommonRefactoringUtil.checkReadOnlyStatus(project, method)) return;

    final PsiClass containingClass = method.getContainingClass();
    final PsiReferenceExpression refExpr = editor != null ? JavaTargetElementEvaluator.findReferenceExpression(editor) : null;
    final boolean allowDelegation = containingClass != null &&
                                    (!containingClass.isInterface() || PsiUtil.isAvailable(JavaFeature.EXTENSION_METHODS, containingClass)) &&
                                    !JavaPsiRecordUtil.isCanonicalConstructor(method);
    InplaceChangeSignature inplaceChangeSignature = editor != null ? InplaceChangeSignature.getCurrentRefactoring(editor) : null;
    ChangeInfo initialChange = inplaceChangeSignature != null ? inplaceChangeSignature.getStableChange() : null;

    boolean isInplace = Registry.is("inplace.change.signature") &&
                        editor != null && editor.getSettings().isVariableInplaceRenameEnabled() &&
                        (initialChange == null || initialChange.getMethod() != method) &&
                        refExpr == null;
    PsiIdentifier nameIdentifier = method.getNameIdentifier();
    LOG.assertTrue(nameIdentifier != null);
    if (isInplace) {
      CommandProcessor.getInstance().executeCommand(project, () -> new InplaceChangeSignature(project, editor, nameIdentifier),
                                                    RefactoringBundle.message("changeSignature.refactoring.name"), null);
    }
    else {
      JavaMethodDescriptor methodDescriptor = new JavaMethodDescriptor(method);
      if (initialChange != null) {
        JavaChangeInfo currentInfo = (JavaChangeInfo)inplaceChangeSignature.getCurrentInfo();
        if (currentInfo != null) {
          methodDescriptor = new JavaMethodDescriptor(method) {
            @Override
            public String getName() {
              return currentInfo.getNewName();
            }

            @Override
            public @NotNull List<ParameterInfoImpl> getParameters() {
              return Arrays.asList((ParameterInfoImpl[])currentInfo.getNewParameters());
            }

            @Override
            public @NotNull String getVisibility() {
              return currentInfo.getNewVisibility();
            }


            @Override
            public int getParametersCount() {
              return currentInfo.getNewParameters().length;
            }

            @Nullable
            @Override
            public String getReturnTypeText() {
              return currentInfo.getNewReturnType().getTypeText();
            }
          };
        }
        inplaceChangeSignature.cancel();
      }
      final DialogWrapper dialog = new JavaChangeSignatureDialog(project, methodDescriptor, allowDelegation, refExpr == null ? method : refExpr);
      dialog.show();
    }
  }
private static void invoke(@NotNull PsiMethod method, @NotNull Project project, @Nullable final Editor editor)