void (PsiTypeParameter typeParameter) { final PsiClassType[] types = typeParameter.getExtendsList().getReferencedTypes(); if (types.length < 1) { return; } final Project project = typeParameter.getProject(); final PsiJavaCodeReferenceElement classReference = JavaPsiFacade.getElementFactory(project).createReferenceElementByType(types[0]); final Query<PsiReference> query = ReferencesSearch.search(typeParameter, typeParameter.getUseScope()); for (PsiReference reference : query) { final PsiElement referenceElement = reference.getElement(); referenceElement.replace(classReference); } }