What does a qualified name mean for a module?

Stephan Herrmann stephan.herrmann at berlin.de
Tue Jun 6 18:28:01 UTC 2017


On 06.06.2017 19:35, David M. Lloyd wrote:
> On 06/06/2017 12:14 PM, Stephan Herrmann wrote:
>> On 06.06.2017 18:59, Alex Buckley wrote:
>>> A module name has the same structure as a package name, so ModuleElement has the same shape as PackageElement: each inherits 
>>> getSimpleName() from Element, and getQualifiedName() from getQualifiedName() from QualifiedNameable.
>>
>> Syntactically you're right, but ...
>>
>> Normally, a qualified name denotes two things: a parent element and a child.
>> The package name "java.lang" has a qualifier "java" which denotes a top-level package
>> and "lang" can be used relative to that package to denote a member package etc.
>>
>> For a module - say "java.base" - the qualifier "java" denotes nothing.
>> And hence, the simple name "base" cannot be resolved in any context.
>>
>> So the question is: should ModuleElement.getSimpleName() answer the
>> totally useless last segment of the name, or should it answer the same
>> as getQualifiedName()?
> 
> The answer to that question should apply to PackageElement too, for identical reasons.  However, PackageElement is established API 
> already...
> 

For packages it is established confusion that some say, a package
"java.lang" has a parent package "java" so that "lang" can be resolved
as a member of that parent, and others say that the structure of package
names bears no semantic significance.

For the former group the simple name of a package has significance,
for the latter it doesn't.

Both are right <sigh>

For modules there is only the latter view, there is no JLS 6.5.3.2 for modules.
But if some spec will say what a simple name of a module is, it's of course
trivial to implement (and hopefully nobody will be tempted to use that method).

Stephan



More information about the jigsaw-dev mailing list