public static boolean canBePrivate(@NotNull PsiMember member, @NotNull PsiModifierList modifierList) {
    final PsiModifierList modifierListCopy = (PsiModifierList)modifierList.copy();
    modifierListCopy.setModifierProperty(PsiModifier.PRIVATE, true);
    return ReferencesSearch.search(member, member.getUseScope()).allMatch(
      reference -> JavaResolveUtil.isAccessible(member, member.getContainingClass(), modifierListCopy, reference.getElement(),
                                                WeakenVisibilityFix.findAccessObjectClass(reference, member), null));
  }
public static boolean canBePrivate(@NotNull PsiMember member, @NotNull PsiModifierList modifierList)