public static MultiMap<PsiElement, @DialogMessage String> checkConflicts(MemberInfoBase<? extends PsiMember>[] infos,
                                                                           @NotNull PsiClass subclass,
                                                                           @Nullable PsiClass superClass,
                                                                           @NotNull PsiPackage targetPackage,
                                                                           @NotNull PsiDirectory targetDirectory,
                                                                           InterfaceContainmentVerifier interfaceContainmentVerifier,
                                                                           boolean movedMembers2Super) {
    final Set<PsiMember> movedMembers = new HashSet<>();
    final Set<PsiMethod> abstractMethods = new HashSet<>();
    final boolean isInterfaceTarget;
    final PsiElement targetRepresentativeElement;
    if (superClass != null) {
      isInterfaceTarget = superClass.isInterface();
      targetRepresentativeElement = superClass;
    }
    else {
      isInterfaceTarget = false;
      targetRepresentativeElement = targetDirectory;
    }
    for (MemberInfoBase<? extends PsiMember> info : infos) {
      PsiMember member = info.getMember();
      if (member instanceof PsiMethod) {
        if (!info.isToAbstract()) {
          movedMembers.add(member);
        }
        else {
          abstractMethods.add((PsiMethod)member);
        }
      }
      else {
        movedMembers.add(member);
      }
    }
    final MultiMap<PsiElement, @DialogMessage String> conflicts = new MultiMap<>();
    final Set<PsiMethod> abstrMethods = new HashSet<>(abstractMethods);
    if (superClass != null && movedMembers2Super) {
      for (PsiMethod method : subclass.getMethods()) {
        if (!movedMembers.contains(method) && !method.hasModifierProperty(PsiModifier.PRIVATE)) {
          if (method.findSuperMethods(superClass).length > 0) {
            abstrMethods.add(method);
          }
        }
      }

      List<PsiMethod> newAbstractMethods = newAbstractMethodInSuper(infos);
      if (!newAbstractMethods.isEmpty()) {
        final PsiAnnotation annotation = AnnotationUtil.findAnnotation(superClass, CommonClassNames.JAVA_LANG_FUNCTIONAL_INTERFACE);
        if (annotation != null) {
          conflicts.putValue(annotation, JavaRefactoringBundle.message("functional.interface.broken"));
        } else {
          final PsiFunctionalExpression functionalExpression = FunctionalExpressionSearch.search(superClass).findFirst();
          if (functionalExpression != null) {
            conflicts.putValue(functionalExpression, JavaRefactoringBundle.message("functional.interface.broken"));
          }
          ClassInheritorsSearch.search(superClass).forEach(sClass -> {
            if (!sClass.isInheritor(subclass, true) && !sClass.hasModifierProperty(PsiModifier.ABSTRACT)) {
              for (PsiMethod aMethod : newAbstractMethods) {
                if (MethodSignatureUtil.findMethodBySignature(sClass, aMethod, true) == null) {
                  String description = RefactoringUIUtil.getDescription(sClass, true);
                  conflicts.putValue(sClass, JavaBundle.message("pull.up.concrete.inherit.abstract.method.conflict", description));
                }
              }
            }
            return true;
          });
        }
      }
    }
    RefactoringConflictsUtil.getInstance()
      .analyzeAccessibilityConflictsAfterMemberMove(movedMembers, superClass, VisibilityUtil.ESCALATE_VISIBILITY,
                                                    targetRepresentativeElement, abstrMethods, Conditions.alwaysTrue(), conflicts
      );
    if (superClass != null) {
      if (movedMembers2Super) {
        checkSuperclassMembers(superClass, infos, conflicts);
        if (isInterfaceTarget) {
          checkInterfaceTarget(infos, conflicts);
        }
      } else {
        final String qualifiedName = superClass.getQualifiedName();
        assert qualifiedName != null;
        if (superClass.hasModifierProperty(PsiModifier.PACKAGE_LOCAL)) {
          if (!Comparing.strEqual(StringUtil.getPackageName(qualifiedName), targetPackage.getQualifiedName())) {
            conflicts.putValue(superClass, JavaBundle
              .message("pull.up.accessible.conflict.1", RefactoringUIUtil.getDescription(superClass, true),
                       RefactoringUIUtil.getDescription(targetPackage, true)));
          }
        }
      }
    }
    // check if moved methods use other members in the classes between Subclass and Superclass
    List<PsiElement> checkModuleConflictsList = new ArrayList<>();
    for (PsiMember member : movedMembers) {
      if (member instanceof PsiMethod || member instanceof PsiClass && !(member instanceof PsiCompiledElement)) {
        ClassMemberReferencesVisitor visitor =
          movedMembers2Super? new ConflictingUsagesOfSubClassMembers(member, movedMembers, abstractMethods, subclass, superClass,
                                                 superClass != null ? null : targetPackage, conflicts,
                                                 interfaceContainmentVerifier)
                            : new ConflictingUsagesOfSuperClassMembers(member, subclass, targetPackage, movedMembers, conflicts);
        member.accept(visitor);
      }
      ContainerUtil.addIfNotNull(checkModuleConflictsList, member);
    }
    for (final PsiMethod method : abstractMethods) {
      ContainerUtil.addIfNotNull(checkModuleConflictsList, method.getParameterList());
      ContainerUtil.addIfNotNull(checkModuleConflictsList, method.getReturnTypeElement());
      ContainerUtil.addIfNotNull(checkModuleConflictsList, method.getTypeParameterList());
    }
    final VirtualFile vFile = PsiUtilCore.getVirtualFile(targetDirectory);
    if (vFile != null) {
      RefactoringConflictsUtil.getInstance()
        .analyzeModuleConflicts(subclass.getProject(), checkModuleConflictsList, UsageInfo.EMPTY_ARRAY, vFile, conflicts);
    }

    final PsiClassOwner psiFile = PsiTreeUtil.getParentOfType(subclass, PsiClassOwner.class);
    final boolean toDifferentPackage = !Comparing.strEqual(targetPackage.getQualifiedName(),
                                                           psiFile != null ? psiFile.getPackageName() : null);
    for (final PsiMethod abstractMethod : abstractMethods) {
      abstractMethod.accept(new ClassMemberReferencesVisitor(subclass) {
        @Override
        protected void visitClassMemberReferenceElement(PsiMember classMember, PsiJavaCodeReferenceElement classMemberReference) {
          if (classMember != null && willBeMoved(classMember, movedMembers)) {
            boolean isAccessible = false;
            if (classMember.hasModifierProperty(PsiModifier.PRIVATE)) {
              isAccessible = true;
            }
            else if (classMember.hasModifierProperty(PsiModifier.PACKAGE_LOCAL) &&
                     toDifferentPackage) {
              isAccessible = true;
            }
            if (isAccessible) {
              String message = JavaRefactoringBundle
                .message("push.up.abstract.accessibility.in.subclass.conflict", RefactoringUIUtil.getDescription(abstractMethod, false),
                         RefactoringUIUtil.getDescription(classMember, true));
              message = StringUtil.capitalize(message);
              conflicts.putValue(classMember, message);
            }
          }
        }
      });
      if (abstractMethod.hasModifierProperty(PsiModifier.PACKAGE_LOCAL) && toDifferentPackage) {
        if (!isInterfaceTarget) {
          String message = JavaRefactoringBundle
            .message("push.up.abstract.accessible.from.the.subclass.conflict", RefactoringUIUtil.getDescription(abstractMethod, false));
          message = StringUtil.capitalize(message);
          conflicts.putValue(abstractMethod, message);
        }
      }
    }
    return conflicts;
  }
public static MultiMap<PsiElement, @DialogMessage String> checkConflicts(MemberInfoBase<? extends PsiMember>[] infos,
                                                                           @NotNull PsiClass subclass,
                                                                           @Nullable PsiClass superClass,
                                                                           @NotNull PsiPackage targetPackage,
                                                                           @NotNull PsiDirectory targetDirectory,
                                                                           InterfaceContainmentVerifier interfaceContainmentVerifier,
                                                                           boolean movedMembers2Super)