private void checkFile(PsiJavaFile file, ProblemsHolder delegate, boolean isOnTheFly) {
    PsiPackage pkg = JavaDirectoryService.getInstance().getPackage(file.getContainingDirectory());
    if (pkg == null) return;

    PsiDocComment docComment = PsiTreeUtil.getChildOfType(file, PsiDocComment.class);
    if (IGNORE_DEPRECATED_ELEMENTS && isDeprecated(pkg, docComment)) {
      return;
    }
    if (!isJavadocRequired(PACKAGE_SETTINGS, pkg)) return;

    if (docComment != null) {
      checkRequiredTags(docComment.getTags(), PACKAGE_SETTINGS, docComment.getFirstChild(), delegate);
    }
    else {
      PsiElement toHighlight = notNull(file.getPackageStatement(), file);
      reportMissingJavadoc(toHighlight, delegate, isOnTheFly);
    }
  }
private void checkFile(PsiJavaFile file, ProblemsHolder delegate, boolean isOnTheFly)