code: protected void includeClassFile(PackageSymbol p, JavaFileObject file) {
          if ((p.flags_field & EXISTS) == 0)
              for (Symbol q = p; q != null && q.kind == PCK; q = q.owner)
                  q.flags_field |= EXISTS;
          JavaFileObject.Kind kind = file.getKind();
          int seen;
          if (kind == JavaFileObject.Kind.CLASS)
              seen = CLASS_SEEN;
          else
              seen = SOURCE_SEEN;
          String binaryName = fileManager.inferBinaryName(currentLoc, file);
          int lastDot = binaryName.lastIndexOf(".");
          Name classname = names.fromString(binaryName.substring(lastDot + 1));
          boolean isPkgInfo = classname == names.package_info;
          ClassSymbol c = isPkgInfo
              ? p.package_info
              : (ClassSymbol) p.members_field.lookup(classname).sym;
          if (c == null) {
              c = enterClass(classname, p);
              if (c.classfile == null) // only update the file if's it's newly created
                  c.classfile = file;
              if (isPkgInfo) {
                  p.package_info = c;
              } else {
                  if (c.owner == p)  // it might be an inner class
                      p.members_field.enter(c);
              }
          } else if (c.classfile != null && (c.flags_field & seen) == 0) {
              // if c.classfile == null, we are currently compiling this class
              // and no further action is necessary.
              // if (c.flags_field & seen) != 0, we have already encountered
              // a file of the same kind; again no further action is necessary.
              if ((c.flags_field & (CLASS_SEEN | SOURCE_SEEN)) != 0)
                  c.classfile = preferredFileObject(file, c.classfile);
          }
          c.flags_field |= seen;
      }
docs: Include class corresponding to given class file in package,
  unless (1) we already have one the same kind (.class or .java), or
  (2) we have one of the other kind, and the given class file
  is older.