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()?

Stephan


Alex

On 6/6/2017 7:24 AM, Jayaprakash Artanareeswaran wrote:
Hello,


The newly introduced ModuleElement has two APIs to get a module's name, namely getQualifiedName() and getSimpleName(). The JLS, though says a module only has one name.


"A module name consists of one or more Java identifiers (ยง3.8) separated by "."
tokens."


I also see this in the "JPMS: Modules in the Java Language and JVM":

ModuleName:
   Identifier
   ModuleName . Identifier

I am not really sure what a qualifier for a module is. In the given example

Module M.N {}

are 'M' and 'N' separate names and if so, what do they denote?

Jay


Reply via email to