private static boolean isJavadocRequired(@NotNull Options options, @NotNull PsiModifierListOwner element) {
    if (!options.ENABLED) return false;
    if (element instanceof PsiPackage) {
      return true;
    }

    if (element instanceof PsiJavaModule) {
      return true;
    }

    int actualAccess = getAccessNumber(RefJavaUtil.getInstance().getAccessModifier(element));

    if (element instanceof PsiClass) {
      return actualAccess <= getAccessNumber(options.MINIMAL_VISIBILITY);
    }

    if (element instanceof PsiMember) {
      element = PsiTreeUtil.getParentOfType(element, PsiClass.class);
      while (element != null) {
        actualAccess = Math.max(actualAccess, getAccessNumber(RefJavaUtil.getInstance().getAccessModifier(element)));
        element = PsiTreeUtil.getParentOfType(element, PsiClass.class);
      }

      return actualAccess <= getAccessNumber(options.MINIMAL_VISIBILITY);
    }

    return false;
  }
private static boolean isJavadocRequired(@NotNull Options options, @NotNull PsiModifierListOwner element)