RFR: Further support for JSON-based module-info descriptors

David Bosschaert david.bosschaert at gmail.com
Thu May 17 04:43:10 PDT 2012


On 15 May 2012 10:52, David Bosschaert <david.bosschaert at gmail.com> wrote:
> On 15 May 2012 08:48, Shi Jun Zhang <zhangshj at linux.vnet.ibm.com> wrote:
>> On 5/14/2012 4:09 PM, David Bosschaert wrote:
>>>
>>> Hi all,
>>>
>>> I've expanded the JSON-based module descriptor support. I think it now
>>> supports all the features that module-info.java supports.
>>> I also added encoding detection to the JSON parser code. According to
>>> http://www.ietf.org/rfc/rfc4627.txt section 3 a JSON file should
>>> always be in unicode. The JSON parser can now deal with UTF-8, UTF-16
>>> and UTF-32 (there are test files included to test this functionality
>>> too).
>>> Also added, more tests, including a test that shows how a
>>> module-info.json file can be expanded with custom metadata, very much
>>> like what it could look for OSGi.
>>>
>>> You can find the webrev here:
>>> http://cr.openjdk.java.net/~davidb/mijson2/webrev.01
>>>
>>> Best regards,
>>>
>>> David
>>>
>> Hi David,
>>
>> The patch looks good to me.
>>
>> One question: Is there any API to get the custom metadata?
>
> Hi Shi Jun,
>
> It's a good question which probably requires some further discussion
> and thought.
> Personally I was thinking that there is no need for such an API. The
> JSON metadata will be available in the module/jar file in
> META-INF/module-info.json so any other component can still obtain it
> as-is and parse it for its own needs, obtaining any extensions to the
> metadata that it's interested in.
>
> Another benefit of not providing the metadata through an API is that
> the module information inside JavaSE does not need to remember this in
> any way. It can just parse the pieces of module-info.json that its
> interested in and skip the rest. So there is a memory footprint
> benefit there too.
>
> Best regards,
>
> David

I have extended the hello-json-custom.sh test to show how the custom
JSON data can be read.

You can see it in the webrev here:
http://cr.openjdk.java.net/~davidb/readcustomjson/webrev.00/

WDYT?

Cheers,

David


More information about the penrose-dev mailing list