private boolean isAccessibleForResolve(@Nullable PsiElement element) {
    if (element instanceof PsiMember member) {
      Set<PsiClass> accessObjectClasses =
        !myQualified ? Collections.singleton(null) :
        myQualifierType instanceof PsiIntersectionType ? ContainerUtil.map2Set(((PsiIntersectionType)myQualifierType).getConjuncts(),
                                                                               PsiUtil::resolveClassInClassTypeOnly) :
        Collections.singleton(PsiUtil.resolveClassInClassTypeOnly(myQualifierType));
      PsiResolveHelper helper = getResolveHelper();
      PsiModifierList modifierList = member.getModifierList();
      return ContainerUtil.exists(accessObjectClasses, aoc ->
        helper.isAccessible(member, modifierList, myElement, aoc, myDeclarationHolder));
    }
    if (element instanceof PsiPackage) {
      return getResolveHelper().isAccessible((PsiPackage)element, myElement);
    }
    return true;
  }
private boolean isAccessibleForResolve(@Nullable PsiElement element)