void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { PsiTypeElement typeElement = ObjectUtils.tryCast(element, PsiTypeElement.class); if (typeElement == null) return; PsiElementFactory factory = JavaPsiFacade.getElementFactory(project); PsiTypeElement replacement = factory.createTypeElement(factory.createTypeFromText(myWantedTypeCanonicalText, typeElement)); typeElement.replace(replacement); }