Module file parse API
Alan Bateman
Alan.Bateman at oracle.com
Tue Jun 19 07:19:55 PDT 2012
On 13/06/2012 11:42, Chris Hegarty wrote:
> Hi,
>
> A while back it was suggested that it may be useful to define a pull
> parser type API for reading from a module file. I gives separation of
> the parsing of the module file from the writing of it (either
> installing into the module library, or extraction elsewhere ).
>
> I've prototyped such an API and updated the ModuleFile.Reader to use
> it. The first four files in the webrev contain the API, its
> implementation, and a test that demonstrates some sample usage (
> extraction of one or more classes, listing sections, verifying hashes
> ). The remainder of the changes simply updates some of the tools for
> installing and handling signed modules.
>
> http://cr.openjdk.java.net/~chegar/jigsaw/moduleParser_webrev.00/webrev/
>
> Thanks,
> -Chris.
I skimmed through this (not a detailed review) and the approach looks
very reasonable and nicely done. I agree with Paul's comment that it
would be good to think about the case where a tool needs to read/extract
a module from a module library too. In that usage it would be more of a
stream reader rather than a parser.
A minor comment is that fileHeader() should be clear that it will return
the header at any time, irrespective of which section the cursor is at.
One method that stands out a bit is getClasses where an alternative
would be to specify how it is laid out in the content stream and then
provide a helper that decodes the stream into map entries. I'm not
saying should need to change to this, just something to think about in
the context of providing more support for specific sections / content type.
Minor nit noticed in passing is that ClassesEntry.setValue should
probably throw UOE.
-Alan.
More information about the jigsaw-dev
mailing list