Small conflicts in § 1.1 of the JLS?

Volker Simonis volker.simonis at gmail.com
Mon May 22 09:53:43 UTC 2017


Hi,

after reading chapter § 1.1 of the JLS I have some problems
understanding the following sections with regards to the definition of
the "opens" and "exports" keywords. The following two sections which
specify the semantics of "normal" and "open" modules are clear:

"A normal module, without the open modifier, grants access at compile
time and run time to types in only those packages which are explicitly
exported. In addition, a normal module grants reflective access to
types in only those packages which are explicitly opened."

"An open module, with the open modifier, grants access at compile time
to types in only those packages which are explicitly exported, but
grants access at run time to types in all its packages, as if all
packages had been exported. In addition, an open module grants
reflective access to types in all its packages."

But in the following section:

"For code outside the module, the access granted at compile time and
run time to types in exported packages is specifically to the public
and protected types in those packages, plus the public and protected
members of those types. However, for code outside the module, no
access is granted at compile time and run time to types in packages
which are not exported. (This applies regardless of whether reflective
access is granted.) Code inside the module may access public and
protected types of all packages in the module."

the sentence in parenthesis (i.e. "This applies regardless of whether
reflective access is granted") seems to contradict with the previous
definition of "opens" which explicitly states that it not only "grants
reflective access" but also "grants access at run time to types in all
its packages, as if all packages had been exported". So from my point
of view, the last section should read something like:

"... However, for code outside the module, no access is granted at
compile time and run time to types in packages which are not exported
and no access is granted at run time to types in packages which are
not exported and/or opened. ..."

and the sentence in parenthesis (i.e. "This applies regardless of
whether reflective access is granted") should be removed.

Finally, to nit-pick, I think there's a missing "a" in the following
section of § 1.1.2:

"The opens keyword takes a qualified identifier indicating the name of
package to be opened by the current module."

It should read:

"The opens keyword takes a qualified identifier indicating the name of
__a__ package to be opened by the current module."

Also, I think it should read "The opens statement" instead of "The
opens keyword"

What do you think?

Thank you and best regards,
Volker


More information about the jpms-spec-comments mailing list