Resources

Mark Reinhold mr at sun.com
Tue May 5 22:33:27 PDT 2009


I've pushed code to support "resources", i.e., the getResource(String)
and getResources(String) methods declared in java.lang.ClassLoader.

>From the explanatory comment in the Loader class:

  The approach taken here is simply to discover resources at run time.
  Given a resource name we first search this loader's modules for that
  resource; we then search the loaders for every other context in this
  configuration.  If we think of a Jigsaw configuration as a "better
  class path" then this isn't completely unreasonable, but it is meant
  to be temporary.

  An eventual fuller treatment of resources will treat them more like
  classes, resolving them statically, allowing them to be declared
  private to a module or public, and re-exporting them from one
  context to another when "requires public" is used.

(Aside: I'm reminded once again how utterly horrible it is that the
 getResource{,s} methods return URLs.  We really must define a better
 alternative, and one that doesn't expose paths into module libraries!)

A related addition is the Manifest class, an instance of which describes
the files that comprise a module for installation or packaging purposes.
The Library install and preInstall methods now take manifest collections
rather than bare classes directories.

- Mark


[1] http://hg.openjdk.java.net/jigsaw/jigsaw/jdk/rev/0449e4f8376e



More information about the jigsaw-dev mailing list