void (@NotNull Project project, @NotNull PsiElement identifier, @NotNull ModPsiUpdater updater) { final PsiElement parent = identifier.getParent(); if (parent instanceof PsiTypeParameter typeParameter) { final PsiReferenceList extendsList = typeParameter.getExtendsList(); final PsiJavaCodeReferenceElement[] referenceElements = extendsList.getReferenceElements(); for (PsiJavaCodeReferenceElement referenceElement : referenceElements) { referenceElement.delete(); } } else { final PsiTypeElement typeElement = (PsiTypeElement)parent; PsiElement child = typeElement.getLastChild(); while (child != null) { if (child instanceof PsiJavaToken javaToken) { final IElementType tokenType = javaToken.getTokenType(); if (tokenType == JavaTokenType.QUEST) { return; } } child.delete(); child = typeElement.getLastChild(); } } }