Proposal: #ClassFileModuleName

Remi Forax forax at univ-mlv.fr
Wed Nov 30 23:19:35 UTC 2016


Hi Mark,
I've just finished to update ASM6 to use the new classfile format.
Practically, setting this_class to zero create several NPEs in the the visitors provided with ASM because a lot of them try to use indexOf on the name of the class (to find the package name).
Given that the classfile for a package-info is named "foo/bar/package-info", i think it's a good idea to use "module-info" instead of null as class name for a module-info.class, it will help at least my users .

regards,
Rémi 

----- Mail original -----
> De: "Remi Forax" <forax at univ-mlv.fr>
> À: "mark reinhold" <mark.reinhold at oracle.com>
> Cc: jpms-spec-experts at openjdk.java.net
> Envoyé: Mercredi 23 Novembre 2016 21:03:25
> Objet: Re: Proposal: #ClassFileModuleName

> I'm pleased with this proposal,
> if obviously, module name are NOT in internal form.
> 
> regards,
> Rémi
> 
> ----- Mail original -----
>> De: "mark reinhold" <mark.reinhold at oracle.com>
>> À: jpms-spec-experts at openjdk.java.net
>> Envoyé: Mardi 22 Novembre 2016 17:47:35
>> Objet: Proposal: #ClassFileModuleName
> 
>> 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