private void changeSignature(PsiVariable myVariable, PsiParameter myParameter, PsiMethod method) {
    final PsiMethod psiMethod = SuperMethodWarningUtil.checkSuperMethod(method);
    if (psiMethod == null) return;
    final int parameterIndex = method.getParameterList().getParameterIndex(myParameter);
    if (!FileModificationService.getInstance().prepareFileForWrite(psiMethod.getContainingFile())) return;
    final ArrayList<ParameterInfoImpl> infos = new ArrayList<>();
    int i = 0;
    for (PsiParameter parameter : psiMethod.getParameterList().getParameters()) {
      final boolean changeType = i == parameterIndex;
      infos.add(ParameterInfoImpl.create(i++)
                  .withName(parameter.getName())
                  .withType(changeType ? getReturnType() : parameter.getType()));
    }

    if (!ApplicationManager.getApplication().isUnitTestMode()) {
      final JavaChangeSignatureDialog dialog = new JavaChangeSignatureDialog(psiMethod.getProject(), psiMethod, false, myVariable);
      dialog.setParameterInfos(infos);
      dialog.show();
    }
    else {
      ParameterInfoImpl @NotNull [] parameterInfo = infos.toArray(new ParameterInfoImpl[0]);
      var processor = JavaRefactoringFactory.getInstance(psiMethod.getProject())
        .createChangeSignatureProcessor(psiMethod, false, null, psiMethod.getName(), psiMethod.getReturnType(), parameterInfo, null, null,
                                        null, null);
      processor.run();
    }
  }
private void changeSignature(PsiVariable myVariable, PsiParameter myParameter, PsiMethod method)