Proposal: #ModuleNameCharacters

David M. Lloyd david.lloyd at
Wed Nov 30 02:50:11 UTC 2016

On 11/29/2016 06:11 PM, mark.reinhold at wrote:
> 2016/11/23 11:59:58 -0800, forax at
>> I agree with David, module names are just names so there should be
>> encoded as 'UTF8' kind of constant with no restriction.
>> Java (the language) module name format has more restrictions because
>> javac has to compile files, but in the bytecode there
>> is no need to encode module name as 'internal name'.
>> When doing the JSR 292 spec, we (the EG) removed all the constraints
>> on class name, method name, etc that could be removed, in order to
>> ease the mapping of any languages on top of the VM.
> Most, if not all, such constraints were removed long before JSR 292.
> For those that remain, John Rose proposed a fairly straightforward
> name-mangling scheme [1].
>>                                                      If we want ease
>> the mapping between any existing and future module system to JPMS,
>> module name inside the class file format should be plain string
>> constant.
> As I wrote in my reply to David, I'm open to lifting the traditional
> restrictions on the class-file representation of qualified names in the
> case of module names.  Given the weight of tradition and the past value
> of the existing constraints, however, I'd like to have a more compelling
> reason than "some future hypothetical module system might need this
> flexibility".

The key point is exactly that a present, concrete module system does 
need this flexibility; ours, specifically.  And this is such an easy change.

> In trying to think about the future I do wonder if, today, we should
> reserve a character or two just in case we discover five or ten years
> from now that we need to add more structure to module names.  Should
> we set aside `:`, or perhaps some other character, just in case?

We have had a module system with no character restrictions for many 
years now and never looked back.  It adds flexibility as every module 
loader can establish acceptable name rules based on its policy, which 
afforded us a great deal of interoperability with all manner of system. 
You can still have reserved characters if that's what is appropriate to 
your module resolver; if a name is invalid for that resolver, the 
resolver can simply return no match.


More information about the jpms-spec-observers mailing list