The keywords added for module declarations in Java 9 are summarized in
§3.9 of the Java Language Specification, Java SE 9
Edition:
A further ten character sequences are restricted keywords: open
,
module
, requires
, transitive
, exports
, opens
, to
, uses
,
provides
, and with
. These character sequences are tokenized as
keywords solely where they appear as terminals in the ModuleDeclaration
and ModuleDirective productions (§7.7). They are tokenized as
identifiers everywhere else, for compatibility with programs written
prior to Java SE 9. There is one exception: immediately to the right
of the character sequence requires in the ModuleDirective production,
the character sequence transitive is tokenized as a keyword unless it
is followed by a separator, in which case it is tokenized as an
identifier.
If you presently have a method named module
, or any of the other
keywords listed here, it will continue to compile.
(view
and permits
were keywords in an early Jigsaw prototype, but
they were simplified out of existence long ago.)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…