void (@NotNull Template template, boolean brokenOff) { if (!brokenOff) { final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(project); try { final PsiType targetParam = elementFactory.createTypeFromText(myNewType, aClass); if (!(targetParam instanceof PsiClassType classType)) { HintManager.getInstance().showErrorHint(editor, JavaErrorBundle.message("generics.type.argument.cannot.be.of.primitive.type")); return; } final PsiClass target = classType.resolve(); if (target == null) { HintManager.getInstance().showErrorHint(editor, JavaErrorBundle.message("cannot.resolve.symbol", classType.getPresentableText())); return; } final PsiSubstitutor substitutor = result.getSubstitutor().put(typeParameter, targetParam); final PsiType targetClassType = elementFactory.createType(baseClass, substitutor); var supportProvider = CommonJavaRefactoringUtil.getRefactoringSupport(); var handler = supportProvider.getChangeTypeSignatureHandler(); handler.runHighlightingTypeMigrationSilently(project, editor, new LocalSearchScope(aClass), ((PsiAnonymousClass)aClass).getBaseClassReference().getParameterList(), targetClassType); } catch (IncorrectOperationException e) { HintManager.getInstance().showErrorHint(editor, TypeMigrationBundle.message("change.class.parameter.incorrect.type.error.hint")); } } }