RFR: Initial code for a JSON-based module descriptor.
David Bosschaert
david.bosschaert at gmail.com
Thu Apr 19 05:05:26 PDT 2012
Following the discussion about module descriptor formats on jigsaw-dev
and penrose-dev [1] I did an initial implementation that supports a
JSON-based module descriptor.
The JSON module descriptor is located inside the module in
META-INF/module-info.json.
The existing module-info.class file is still supported but if a
module-info.json file is found this is used instead.
I wrote a very small JSON parser, its class files are currently <
10kb, and it can possibly be made even smaller.
Besides the unit tests _JSONParser and _ModuleInfoReader there is also
a system-level test hello-json.sh that effectively compiles, installs
and runs a small demo module with JSON metadata.
For example module-info.json files see inside the hello-json.sh and
module-info-reader.sh test scripts.
Some other things to note:
* Not all features of module-info.class are yet supported, this is
just a starting point.
* The fact that both module-info.class and module-info.json are
supported side-by-side makes for some awkward code here and there.
This should only be temporary.
* The JSON parser is currently in the java.lang.module package, but
it's pretty much general-purpose, so I guess it could be moved to a
package like java.util or something like that.
You can find the webrev here:
http://cr.openjdk.java.net/~davidb/mijson/webrev.01/
David
[1] http://mail.openjdk.java.net/pipermail/penrose-dev/2012-April/000038.html
More information about the penrose-dev
mailing list