void (PsiClass anInterface) { final PsiReferenceList extendsList = anInterface.getExtendsList(); final PsiReferenceList implementsList = anInterface.getImplementsList(); assert extendsList != null; final PsiJavaCodeReferenceElement[] extendsRefElements = extendsList.getReferenceElements(); for (PsiJavaCodeReferenceElement referenceElement : extendsRefElements) { assert implementsList != null; final PsiElement resolved = referenceElement.resolve(); if (resolved instanceof PsiClass && ((PsiClass)resolved).isInterface()) { implementsList.add(referenceElement); referenceElement.delete(); } } }