Motivation for type-level exports

Alex Buckley alex.buckley at oracle.com
Thu Nov 3 19:10:57 PDT 2011


On 11/3/2011 6:57 PM, David M. Lloyd wrote:
> I think you're confusing the issue of visibility with accessibility.
>
> Your #3 is accommodated via a new access level - "module" - which would
> restrict *accessibility* of a class but not *visibility* of that class.
> Given the presumed availability of the new module-wide access level,
> your #3 is satisfied wholly, yet Neil's question is unanswered.

The pertinent Java Module System requirement is phrased as:

"Encapsulation — If a module contains a type, whether defined therein or 
imported from some other module, then it must be possible to declare 
that it makes that type available for use by modules depending upon it, 
or that it does not do so."

(http://openjdk.java.net/projects/jigsaw/doc/draft-java-module-system-requirements-12#encapsulation)

As noted in the change history, this deliberately doesn't mention 
visibility or accessibility.

As noted in the open requirements, it's not settled whether 
accessibility should be configured by the declaration of a type or 
member (via a 'module' keyword), or by some other denotation (such as 
whether a type is listed as an export by its enclosing module).

It is possible for the JVM to implement access control either way, since 
the JVM will be aware of the module system and module declarations 
therein. This could be in addition to the module system's class loaders 
restricting visibility to non-exported types.

(http://openjdk.java.net/projects/jigsaw/doc/draft-java-module-system-requirements-12#jsr-294)

Alex



More information about the jigsaw-dev mailing list