void (@NotNull final Project project, @NotNull final PsiFile file, @Nullable Editor editor, @NotNull PsiElement startElement, @NotNull PsiElement endElement) { final PsiVariable myVariable = (PsiVariable)startElement; if (changeMethodSignatureIfNeeded(myVariable)) return; WriteCommandAction.writeCommandAction(project, file).withName(getText()).run(() -> { try { myVariable.normalizeDeclaration(); final PsiTypeElement typeElement = myVariable.getTypeElement(); LOG.assertTrue(typeElement != null, myVariable.getClass()); final PsiTypeElement newTypeElement = JavaPsiFacade.getElementFactory(file.getProject()).createTypeElement(getReturnType()); typeElement.replace(newTypeElement); JavaCodeStyleManager.getInstance(project).shortenClassReferences(myVariable); UndoUtil.markPsiFileForUndo(file); } catch (IncorrectOperationException e) { LOG.error(e); } }); }