Proposal: #ClassFileModuleName

mark.reinhold at oracle.com mark.reinhold at oracle.com
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]

Proposal
--------

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.)


[1] http://openjdk.java.net/projects/jigsaw/spec/issues/#ClassFileModuleName
[2] http://cr.openjdk.java.net/~mr/jigsaw/spec/lang-vm.html
[3] http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.2.1


More information about the jpms-spec-experts mailing list