Proposal: #ClassFileModuleName

mark.reinhold at mark.reinhold at
Tue Nov 22 16:47:35 UTC 2016

Issue summary

  #ClassFileModuleName --- The name of a module is not a simple UTF-8
  string but is, rather, derived from the value of the `this_class`
  field of the `ClassFile` structure, which is awkward. [1]


Revise the binary form of module declarations [2] as follows:

  - Add a `u2 module_name_index` field to the `Module` class-file
    attribute, immediately preceding the existing `module_flags` field.
    The value of this field will be the index of a `CONSTANT_Utf8_info`
    structure in the constant pool that represents the module's name in
    internal form, i.e., with period characters replaced by slashes [3].

  - Rather than encode the module's name in the value of the `this_class`
    field of the `ClassFile` structure, simply set this field to zero.

(Side note: The prototype implementation does not store module names in
 internal form, even though the draft specification [2] has long mandated
 that.  The implementation will be fixed.)


More information about the jpms-spec-experts mailing list