Compiling Java 9 (take 2)
stephan.herrmann at berlin.de
Thu Jan 12 11:44:24 UTC 2017
On 01/10/2017 11:24 PM, Alex Buckley wrote:
> On 1/10/2017 12:20 PM, Stephan Herrmann wrote:
>> Can a module export a package even if no compilation units of that package
>> are associated with the current module? The export might only affect types
>> exported from some other required module. Is that allowed?
> There is no re-exporting of another module's packages. Per lang-vm.html, "It is a compile-time error if the package specified by
> exports is not observable in the current module."
> Then: "If the package specified by exports is observable in the current module, then at least one compilation unit containing a
> declaration of the package must be observable in the current module, or a compile-time error occurs."
> "observable in the current module" needs to be reworded, but I hope you can see the intent.
Yes and no. I'm still not sure how to implement this but it helps
to raise new questions: what's the layering of concepts "observable"
and "associated to a module"?
From 7.3 I understand:
- observability is determined by the host system (so JLS doesn't have the rules)
- if a compilation unit is observable it can be associated to a module
Now you mention a paragraph where "observable" can only be answered
relative to a module, so we first need to know the association to modules
before we can answer observability. This sounds cyclic to me.
Or is "observable" a different concept than "observable in the current module"?
Since the body of JLS uses terms observable, accessible and others
without reference to a module, we need a definite list, which of
these notions are global (i.e., if entity X is Y at location Z it
is Y at any location) vs. module specific (entity X is Y only in
locations Z1, Z2...). The non-spec introduction in lang-vm mentions
that "visible" (of compilation units! of packages??) and "accessible"
belong in this group. Any others?
In addition it would be great, if some place would make the layering
of concepts explicit. Is the set of observable cus a superset of
those cus that are associated to a module, or vice versa, etc.
If that cannot be done we seem to have (more) cycles in JLS, right?
More information about the jigsaw-dev