RFR: 8335989: Implement Module Import Declarations (Second Preview) [v3]

Maurizio Cimadamore mcimadamore at openjdk.org
Mon Oct 21 11:15:14 UTC 2024


On Mon, 21 Oct 2024 11:07:29 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Jan Lahoda has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 15 commits:
>> 
>>  - Merge branch 'master' into JDK-8335989
>>  - Reflecting review feedback.
>>  - Cleanup.
>>  - Cleanup.
>>  - Fixing tests
>>  - Adding a separate scope for module imports.
>>  - Cleanup.
>>  - Make very sure java.base is completed.
>>  - Keep jdk.internal.javac qualified export from java.base.
>>  - Adding forgotten change.
>>  - ... and 5 more: https://git.openjdk.org/jdk/compare/15815089...b5f9df2a
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java line 454:
> 
>> 452:                 // Import on demand.
>> 453:                 chk.checkCanonical(imp.selected);
>> 454:                 if (tree.staticImport) {
> 
> I note a discrepancy here - static imports are reflected in the AST, but module import aren't. This is why we need to pass an extra parameter to this method, I believe. Should we generalize the import tree node to have a bunch of flags?

Nevermind, I see why you need the flag - the code is building synthetic import statements on the fly, based on the packages exported by a module - and then you need to import these synthetic imports, but remember that they originated from an import module...

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/21431#discussion_r1808573586


More information about the compiler-dev mailing list