module-info.class file format

Remi Forax forax at
Sun May 29 21:40:09 UTC 2016

And I've forgotten another important point,
initially ACC_MODULE was thought to be used not only on classes but also on fields and methods (defining an access level).
The idea to use module as a visibility modifier was lost after several iteration of jigsaw but it's value in binary 0x8000 stay the same.

0x8000 is a great value because before JDK9 the value was not defined as a possible values for a class, a method and a field.
Now, using 0x8000 to specify a flag that is only valid on a class seems a waste, 0x0008, 0x0040, 0x0080, 0x0100, 0x0800 are all not defined for a class and will allow to save 0x8000 for a future use.

So i propose to change ACC_MODULE for one of those value.


----- Mail original -----
> De: "Remi Forax" <forax at>
> À: jpms-spec-experts at
> Envoyé: Dimanche 29 Mai 2016 14:18:35
> Objet: module-info.class file format
> Hi all,
> 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 [1] 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.
> cheers,
> Rémi
> [1]

More information about the jpms-spec-observers mailing list