"Scanning" module contents

Remi Forax forax at univ-mlv.fr
Tue Dec 30 16:15:32 UTC 2014


Hi Cedric,
You can scan the module repository using a virtual FileSystem (NIO2) 
that you can get with the prefix "jrt:/",
so you can write a code like this

FileSystem jrtFs = FileSystems.getFileSystem(new URI("jrt:/"));
for(Path root: jrtFs.getRootDirectories()) {
   try(DirectoryStream<Path> directoryStream = 
Files.newDirectoryStream(root)) {
     for(Path path: directoryStream) {
       System.out.println(path);
     }
   }
}

cheers,
Rémi

On 12/30/2014 01:57 PM, Cédric Champeau wrote:
> Hi guys!
>
> Sorry if it is a dumb question but finding information about Jigsaw is 
> not easy :) I was leveraging this end of year to adapt the Groovy 
> language build for JDK 9. The good news is that we seem to have very 
> little issues with Jigsaw. One of them is in a tool called "groovysh" 
> which is a REPL providing completion, like an IDE would. For example, 
> if you start typing jav<TAB> it would start completing the package 
> name. So far, the list of suggestions was based on elements on 
> classpath, and classes from the JDK were found thanks to scanning JAR 
> files.
>
> The problem is that we now have a new (unsupported) URLConnection 
> type, which is JavaRuntimeURLConnection. I can see it can give me a 
> module name, but I have absolutely no idea what to do with that. For a 
> JAR it was easy because we could scan the entries, but now... Do you 
> have any pointer for code I could look at? It is made a bit harder by 
> the fact that even my IDE doesn't support JDK 9 so I cannot have 
> completion or whatever tools I used to work with when dealing with new 
> APIs ;)
>
> Once this will be fixed, Groovy will officially support 
> building/running on JDK 9, which would be a nice New Year present :)
>
> Thanks!
>



More information about the jigsaw-dev mailing list