JDK-8062069 : Replace jimagefs with jrt file system
  • Type: Sub-task
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 9-repo-jigsaw
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2014-10-24
  • Updated: 2016-01-06
  • Resolved: 2014-11-13
Related Reports
Relates :  
Description
The jimage file system provider creates a FileSystem per jimage file. This needs to change so that a FileSystem per runtime image, obtained with:

   FileSystem fs = FileSystems.getFileSystem( URI.create("jrt:/" );

This allows the API to be used without knowing about the locations of the jimage files. It also hides the fact that there are currently three files.

The resulting FileSystem will have the module names as the names of the files in the top-level directory. The path to Object.class is obtained with:

  fs.getPath("/java.base/java/lang/Object.class);

The current file type detection should be removed.



Comments
Pushed changes (webrev6.zip) to jigsaw m2 repo. http://hg.openjdk.java.net/jigsaw/m2/jdk/rev/102fc000f419
13-11-2014

Changed as per review from Alan. 1) close throws UOE 2) added more tests 3) FileSystemProvider#newFileChannel throws UOE
12-11-2014

Attachment webrev5.zip latest patch for jrtfs. Incremental changes: * removed /META-INF as this is repeated in all the three .jimage files and this will go away with module descriptors. * Added jtreg tests for basic functionality of jrt file system (get, new file system, listing root, a specific module directory, getting input streams for known .class resources). These should be sufficient for javac and other tools.
12-11-2014

Attachment webrev4.zip is latest changes for jrt file system. In this, I've added getFileSystem to transparently initialize an instance on first call and added URI checks. i.e., no need to call newFileSystem to get (single) default instance from the jrt file system provider.
11-11-2014

Attachment webrev3.zip contains changes to expose only module directories and META-INF directory from the root directory of jrtfs:/ file system.
11-11-2014

Attachment webrev2.zip contains (initial) changes for "jrt:/" file system. This does not use jimagefs code at all - straight jimage ImageReader + file system code on top of it. Three (boot, ext, app) .jimage files are opened by file system and searched for paths transparently. Also, "/" directory lists contents from all the three .jimage files.
10-11-2014

Attachment webrev.zip contains changes for jimage file system 1) to use "/" at front of every resource name 2) have end "/" for 'directory' entries 3) /module/package/ directories and resources under it (eg. /java.base/java/lang/Object.class) Resource entries without module names are also preserved for existing tools (javac, rmic) to work in the interim. /java/lang/Object.class as well as /java.base/java/lang/Object.class can be passed to access Object.class resource. The current change is purely on "jimage file system" level with no changes done to underlying .jimage file format or it's contents.
06-11-2014