void (@NotNull final PsiClass aClass, @NotNull final PsiClass oldSuperClass, @NotNull final PsiClass newSuperClass) { PsiMethod[] ownMethods = aClass.getMethods(); // first is own method, second is parent List<Pair<PsiMethod, Set<PsiMethod>>> oldOverridenMethods = ContainerUtil.mapNotNull(ownMethods, m -> { if (m.isConstructor()) return null; PsiMethod[] supers = m.findSuperMethods(oldSuperClass); if (supers.length == 0) return null; return Pair.create(m, ContainerUtil.newHashSet(supers)); }); WriteAction.run(() -> addSuperClass(aClass, oldSuperClass, newSuperClass)); List<MemberInfo> memberInfos = oldOverridenMethods.stream().filter(m -> { Set<PsiMethod> newSupers = ContainerUtil.newHashSet(m.getFirst().findSuperMethods(newSuperClass)); return !newSupers.equals(m.getSecond()); }).map(m -> m.getFirst()) .map(m -> { MemberInfo info = new MemberInfo(m); info.setChecked(true); return info; }).collect(Collectors.toList()); if (memberInfos.isEmpty()) { return; } List<PsiMethod> toDelete = getOverridenMethodsToDelete(memberInfos, newSuperClass.getName(), aClass.getProject()); if (!toDelete.isEmpty()) { WriteAction.run(() -> { for (PsiMethod method : toDelete) { method.delete(); } }); } }