<CONTEXT></BUG>IdeDocumentHistory.getInstance(project).includeCurrentPlaceAsChangePlace();final GrTypeParameterList oldTypeParameterList = psiClass.getTypeParameterList();try {<extra_id_0>IdeDocumentHistory.getInstance(project).includeCurrentPlaceAsChangePlace();final GrTypeParameterList oldTypeParameterList = psiClass.getTypeParameterList();try {<BUG>targetClass.set(CreateClassActionBase.createClassByType(targetDirectory, className, PsiManager.getInstance(project), psiClass,GroovyTemplates.GROOVY_CLASS, true));</BUG>}catch (final IncorrectOperationException e) {ApplicationManager.getApplication().invokeLater(new Runnable() {</CONTEXT>
public static PsiClass createSubclassGroovy(final GrTypeDefinition psiClass, final PsiDirectory targetDirectory, final String className) {final Project project = psiClass.getProject();final Ref<GrTypeDefinition> targetClass = new Ref<GrTypeDefinition>();new WriteCommandAction(project, getTitle(psiClass), getTitle(psiClass)) {@Overrideprotected void run(@NotNull Result result) throws Throwable {targetClass.set(CreateClassActionBase.createClassByType(targetDirectory, className, PsiManager.getInstance(project), psiClass, GroovyTemplates.GROOVY_CLASS, true));