code: static PathFileObject createSimplePathFileObject(JavacPathFileManager fileManager,
              final Path path) {
          return new PathFileObject(fileManager, path) {
              @Override
              String inferBinaryName(Iterable<? extends Path> paths) {
                  Path absPath = path.toAbsolutePath();
                  for (Path p: paths) {
                      Path ap = p.toAbsolutePath();
                      if (absPath.startsWith(ap)) {
                          try {
                              Path rp = ap.relativize(absPath);
                              if (rp != null) // maybe null if absPath same as ap
                                  return toBinaryName(rp);
                          } catch (IllegalArgumentException e) {
                              // ignore this p if cannot relativize path to p
                          }
                      }
                  }
                  return null;
              }
          };
      }
docs: Create a PathFileObject whose binary name might be inferred from its
  position on a search path.