code: static synchronized DocFileFactory getFactory(Configuration configuration) {
          DocFileFactory f = factories.get(configuration);
          if (f == null) {
              JavaFileManager fm = configuration.getFileManager();
              if (fm instanceof StandardJavaFileManager)
                  f = new StandardDocFileFactory(configuration);
              else {
                  try {
                      Class<?> pathFileManagerClass =
                              Class.forName("com.sun.tools.javac.nio.PathFileManager");
                      if (pathFileManagerClass.isAssignableFrom(fm.getClass()))
                          f = new PathDocFileFactory(configuration);
                  } catch (Throwable t) {
                      throw new IllegalStateException(t);
                  }
              }
              factories.put(configuration, f);
          }
          return f;
      }
docs: Get the appropriate factory, based on the file manager given in the
  configuration.