private static Path toPath(FileSystem fileSystem, URI uri) {
    // We have to invoke this method by reflection because while the file system should be
    // an instance of JimfsFileSystem, it may be loaded by a different class loader and as
    // such appear to be a totally different class.
    try {
      Method toPath = fileSystem.getClass().getDeclaredMethod("toPath", URI.class);
      return (Path) toPath.invoke(fileSystem, uri);
    } catch (NoSuchMethodException e) {
      throw new IllegalArgumentException("invalid file system: " + fileSystem, e);
    } catch (InvocationTargetException | IllegalAccessException e) {
      throw new RuntimeException(e);
    }
  }
Invokes the {@code toPath(URI)} method on the given {@code FileSystem}.
jimfs/src/main/java/com/google/common/jimfs/SystemJimfsFileSystemProvider.java