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

Jan Lahoda jlahoda at openjdk.org
Mon Oct 14 19:44:15 UTC 2024


On Mon, 14 Oct 2024 14:23:22 GMT, Alan Bateman <alanb 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/java.base/share/classes/jdk/internal/module/ModuleInfo.java line 421:
> 
>> 419:                     && ((mods.contains(Requires.Modifier.TRANSITIVE) &&
>> 420:                          !previewClassfile &&
>> 421:                          !mn.startsWith("java."))
> 
> Just to double check, will be JLS update specify that it's only allow for java.* aggregator modules?

Only modules that participate in preview should be able to use `requires transitive java.base;` without having the preview flag set. And only modules in the JDK can participate in preview. I believe the JVMS will be updated to cover this.

We may want to restrict the condition here to only `java.se`, I am not sure. (Unless there are other modules that would use the directive, but I am not aware about any right now.)

Normally, the modules that "participate in preview" are those to which `java.base` exports the `jdk.internal.javac` package (and hence can use the `ParticipatesInPreview` annotation), but it didn't seem I can check the `java.base`'s exports at this place, so resorted to this hard-coded check. Hopefully, should only be temporary.

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

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


More information about the compiler-dev mailing list