RFR: 8328481: Implement Module Imports [v9]
Maurizio Cimadamore
mcimadamore at openjdk.org
Thu Apr 18 10:50:04 UTC 2024
On Thu, 18 Apr 2024 06:34:22 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:
>> This is an implementation of JEP JDK-8315129: Module Import Declarations (Preview). Please see the JEP for details:
>> https://bugs.openjdk.org/browse/JDK-8315129
>>
>> It is mostly straightforward - the module imports are parsed, and then expanded to import-on-demand in `TypeEnter`.
>> There is a few notable aspects, however:
>> - the AST node for import (`JCImport`) is holding the imported element as a field access, because so far, the imported element always had to have a '.' (even for import-on-demand). But for module imports, it is permissible to import from a module whose name does not have a dot (`import module m;`). The use of field access for ordinary import seems very useful, so I preferred to keep that, and created a new internal-only AST node for module imports. There is still only one public API AST node/interface, so this is purely an implementation choice.
>> - JShell now supports module imports as well; and the default, implicit, script is changed to use it to import all of `java.base` if preview is enabled. It is expected that the default would be changed if/when the module imports feature is finalized.
>
> Jan Lahoda has updated the pull request incrementally with one additional commit since the last revision:
>
> Updating JEP number and caption.
Marked as reviewed by mcimadamore (Reviewer).
src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties line 3541:
> 3539: # 0: symbol, 1: symbol
> 3540: compiler.err.import.module.does.not.read=\
> 3541: {1} module does not read: {0}
shouldn't it be `module {1} does not read: {0}` ? Also, maybe worth reordering the params?
-------------
PR Review: https://git.openjdk.org/jdk/pull/18614#pullrequestreview-2008496026
PR Review Comment: https://git.openjdk.org/jdk/pull/18614#discussion_r1570474076
More information about the core-libs-dev
mailing list