void (@NotNull Project project, PsiVariable myVariable) { myVariable.normalizeDeclaration(); Objects.requireNonNull(myVariable.getTypeElement()).replace(JavaPsiFacade.getElementFactory(project).createTypeElement(myTargetType)); JavaCodeStyleManager.getInstance(project).shortenClassReferences(myVariable); }