code: private boolean checkPathAndPackage(Path dir, JCTree pkgName) {
          Iterator<String> pathIter = new ParentIterator(dir);
          Iterator<String> pkgIter = new EnclosingPkgIterator(pkgName);
          while (pathIter.hasNext() && pkgIter.hasNext()) {
              if (!pathIter.next().equals(pkgIter.next()))
                  return false;
          }
          return !pkgIter.hasNext(); /*&& !pathIter.hasNext() See JDK-8059598 */
      }
docs: /* Returns true if dir matches pkgName.
  
  Examples:
  (a/b/c, a.b.c) gives true
  (i/j/k, i.x.k) gives false
  
  Currently (x/a/b/c, a.b.c) also gives true. See JDK-8059598.