@NotNull
    private MutablePackageFragmentDescriptor getOrCreatePackageFragmentForFile(
        @NotNull JetFile file) {
      JetPackageDirective packageDirective = file.getPackageDirective();
      assert packageDirective != null : "scripts are not supported";

      MutablePackageFragmentDescriptor fragment =
          packageFragmentProvider.getOrCreateFragment(packageDirective.getFqName());

      ModuleDescriptor module = packageFragmentProvider.getModule();
      DescriptorResolver.resolvePackageHeader(
          packageDirective, module, TypeHierarchyResolver.this.trace);

      trace.record(BindingContext.FILE_TO_PACKAGE_FRAGMENT, file, fragment);

      // Register files corresponding to this package
      // The trace currently does not support bi-di multimaps that would handle this task nicer
      FqName fqName = fragment.getFqName();
      Collection<JetFile> files = trace.get(PACKAGE_TO_FILES, fqName);
      if (files == null) {
        files = Sets.newIdentityHashSet();
      }
      files.add(file);
      trace.record(BindingContext.PACKAGE_TO_FILES, fqName, files);
      return fragment;
    }
  private void checkModifiersAndAnnotationsInPackageDirective(JetFile file) {
    JetPackageDirective packageDirective = file.getPackageDirective();
    if (packageDirective == null) return;

    JetModifierList modifierList = packageDirective.getModifierList();
    if (modifierList == null) return;

    for (JetAnnotationEntry annotationEntry : modifierList.getAnnotationEntries()) {
      JetConstructorCalleeExpression calleeExpression = annotationEntry.getCalleeExpression();
      if (calleeExpression != null) {
        JetReferenceExpression reference = calleeExpression.getConstructorReferenceExpression();
        if (reference != null) {
          trace.report(UNRESOLVED_REFERENCE.on(reference, reference));
        }
      }
    }
    AnnotationTargetChecker.INSTANCE$.check(packageDirective, trace);

    ModifiersChecker.reportIllegalModifiers(
        modifierList, Arrays.asList(JetTokens.MODIFIER_KEYWORDS_ARRAY), trace);
  }