ModCommand (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { final PsiIdentifier classNameIdentifier = (PsiIdentifier)descriptor.getPsiElement(); final PsiClass interfaceClass = (PsiClass)classNameIdentifier.getParent(); final SearchScope searchScope = interfaceClass.getUseScope(); final List<PsiClass> elements = new ArrayList<>(); elements.add(interfaceClass); for (final PsiClass inheritor : ClassInheritorsSearch.search(interfaceClass, searchScope, false)) { elements.add(inheritor); } return ModCommand.psiUpdate(interfaceClass, (cls, updater) -> { moveSubClassExtendsToImplements(ContainerUtil.map(elements, updater::getWritable)); changeClassToInterface(cls); moveImplementsToExtends(cls); }); }