void (@NotNull PsiTypeElement typeElement) { final PsiElement parentType = typeElement.getParent(); if (!(parentType instanceof PsiTypeElement)) return; final PsiElement first; final PsiElement last; final PsiElement right = PsiTreeUtil.skipWhitespacesAndCommentsForward(typeElement); if (PsiUtil.isJavaToken(right, JavaTokenType.OR)) { first = typeElement; last = right; } else if (right == null) { final PsiElement left = PsiTreeUtil.skipWhitespacesAndCommentsBackward(typeElement); if (!(left instanceof PsiJavaToken)) return; final IElementType leftType = ((PsiJavaToken)left).getTokenType(); if (leftType != JavaTokenType.OR) return; first = left; last = typeElement; } else { return; } parentType.deleteChildRange(first, last); final List<PsiTypeElement> typeElements = PsiTreeUtil.getChildrenOfTypeAsList(parentType, PsiTypeElement.class); if (typeElements.size() == 1) { final PsiElement parameter = parentType.getParent(); parameter.addRangeAfter(parentType.getFirstChild(), parentType.getLastChild(), parentType); parentType.delete(); } }