On Thu, 4 Apr 2024 07:30:34 GMT, Jan Lahoda <jlah...@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. This pull request has now been integrated. Changeset: f2c4a413 Author: Jan Lahoda <jlah...@openjdk.org> URL: https://git.openjdk.org/jdk/commit/f2c4a41304d4fe984b79792cb3be460d7026e812 Stats: 1343 lines in 31 files changed: 1268 ins; 17 del; 58 mod 8328481: Implement JEP 476: Module Import Declarations (Preview) Co-authored-by: Jim Laskey <jlas...@openjdk.org> Reviewed-by: mcimadamore, vromero ------------- PR: https://git.openjdk.org/jdk/pull/18614