module-info.class file format
forax at univ-mlv.fr
Sun May 29 12:18:35 UTC 2016
I've implemented the reading/writing of the class file format of a module in ASM,
it was very straightforward, but let me summarize what can be improved:
- the current spec only specifies the Module attribute, not how the main class or the version (by example) are specified.
Moreover, these values are currently implemented as custom attributes of the class and not as attribute of the Module attribute,
which seems more logical (like Code is an attribute of a Method).
So currently, if ASM wants to just followed the spec, it can not provide a way for a user to specify the main class or the module version of a module.
- the module name is specified as a part of a constant pool entry which is tagged as a Class  instead of being specified as a UTF8, like the required dependencies by example.
The spec should be changed so the module name is not extracted from the class name but encoded as a UTF8 in the Module attribute.
It will also make life of users of tools like ASM easier, encoding the module name as package of the module-info breaks an important invariant,
the name of the resource and the name inside the .class are the same. This is not true anymore with a module-info so tools need to be updated to avoid to write module-info.class
inside a package corresponding to the name of the module.
More information about the jpms-spec-observers