void (@NotNull Project project, @NotNull PsiElement startElement, @NotNull ModPsiUpdater updater) { final PsiJavaCodeReferenceElement element = (PsiJavaCodeReferenceElement)startElement; final PsiClass aClass = PsiTreeUtil.getParentOfType(element, PsiClass.class); if (aClass == null) { return; } final PsiReferenceList extendsList = aClass.getExtendsList(); if (extendsList == null) { return; } final PsiMethod[] methods = aClass.getMethods(); if (methods.length > 0) { final PsiElement target = element.resolve(); if (!(target instanceof PsiClass interfaceClass)) { return; } for (PsiMethod method : methods) { if (!ControlFlowUtils.isEmptyCodeBlock(method.getBody())) { continue; } final PsiMethod[] superMethods = method.findSuperMethods(interfaceClass); if (superMethods.length > 0) { method.delete(); } } } element.delete(); final JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(project); final PsiClass adapterClass = psiFacade.findClass(adapterName, aClass.getResolveScope()); if (adapterClass == null) { return; } final PsiJavaCodeReferenceElement referenceElement = psiFacade.getElementFactory().createClassReferenceElement(adapterClass); extendsList.add(referenceElement); }