jdk icon indicating copy to clipboard operation
jdk copied to clipboard

8335989: Implement Module Import Declarations (Second Preview)

Open lahodaj opened this issue 1 year ago • 11 comments

This is a current patch for module imports declarations, second preview. At least the JEP number and preview revision will need to be updated in jdk.internal.javac.PreviewFeature.Feature, but otherwise I believe this is ready to receive feedback.

The main changes are:

  • requires transitive java.base; is permitted, under the preview flag. Both javac and the runtime module system are updated to accept this directive when preview is enabled.
  • the java.se module is using requires transitive java.base;, and is deemed to be participating in preview, so its classfile version is not tainted. Runtime is updated to access requires transitive java.base; in any java.*, considering all of them to be participating in preview. Can be tighten up to only java.se is desired.
  • the types imported through module imports can be shadowed using on-demand imports. So, for example, having:
import module java.base;
import module java.desktop;
...
List l;//ambigous

but:

import module java.base;
import module java.desktop;
import java.util.*;
...
List l;//not ambigous, reference to java.util.List

Progress

  • [x] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • [x] Change must not contain extraneous whitespace
  • [x] Commit message must refer to an issue
  • [ ] Change requires a JEP request to be targeted
  • [ ] Change requires CSR request JDK-8341865 to be approved

Issues

  • JDK-8335989: Implement Module Import Declarations (Second Preview) (Sub-task - P4)
  • JDK-8335987: JEP 494: Module Import Declarations (Second Preview) (JEP)
  • JDK-8341865: Implement Module Import Declarations (Second Preview) (CSR)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/21431/head:pull/21431
$ git checkout pull/21431

Update a local copy of the PR:
$ git checkout pull/21431
$ git pull https://git.openjdk.org/jdk.git pull/21431/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 21431

View PR using the GUI difftool:
$ git pr show -t 21431

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/21431.diff

Webrev

Link to Webrev Comment

lahodaj avatar Oct 09 '24 19:10 lahodaj

:wave: Welcome back jlahoda! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

bridgekeeper[bot] avatar Oct 09 '24 19:10 bridgekeeper[bot]

@lahodaj This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8335989: Implement JEP 494: Module Import Declarations (Second Preview)

Reviewed-by: vromero, abimpoudis, mcimadamore, alanb

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 21 new commits pushed to the master branch:

  • 168b18ec68dd5488704cf76895d2449cd86428a6: 8343958: Remove security manager impl in java.lang.Process and java.lang.Runtime.exec
  • 5ac330b1ac81e932924e0ea10988f2536352be04: 8344039: Remove security manager dependency in java.time
  • 1eb38c8eb7ca12b370f8ae68988890eaf36c5b37: 8343219: Manual clientlibs test failures after SM removal
  • dde6230751672bde5a1bcb52686641f3a8b40cfb: 8343416: CDS dump fails when unregistered class can also be loaded from system modules
  • ffea9809a72777fd6bfac5d0052c7db676aa20d1: 8344023: Unnecessary Hashtable usage in LdapClient.defaultBinaryAttrs
  • 5e01c40b19a5bf4d0266747ca73aca4193799d97: 8343981: Remove usage of security manager from Thread and related classes
  • dbf23466aff902836838f06bcbbf3c9e7c5e9c6a: 8341260: Add Float16 to jdk.incubator.vector
  • a5f11b5f775be6c1d9593562ba65912261efdf52: 8343483: Remove unnecessary @SuppressWarnings annotations (serviceability)
  • 7be77725eab6f45d8f8d23f2ba0d18d2d89a40aa: 8344112: Remove code to support security manager execution mode from DatagramChannel implementation
  • bd3fec3075829efc0afe7a99d7a684cf81cc5bbb: 8344086: Remove security manager dependency in FFM
  • ... and 11 more: https://git.openjdk.org/jdk/compare/79345bbbae2564f9f523859d1227a1784293b20f...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

openjdk[bot] avatar Oct 09 '24 19:10 openjdk[bot]

/jep JDK-8335987

lahodaj avatar Oct 09 '24 20:10 lahodaj

@lahodaj The following labels will be automatically applied to this pull request:

  • build
  • compiler
  • core-libs

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

openjdk[bot] avatar Oct 09 '24 20:10 openjdk[bot]

@lahodaj This pull request will not be integrated until the JEP JDK-8335987 has been targeted.

openjdk[bot] avatar Oct 09 '24 20:10 openjdk[bot]

Webrevs

mlbridge[bot] avatar Oct 09 '24 20:10 mlbridge[bot]

Can you check if test/jdk/java/lang/module/ClassFileVersionsTest.java should be updated too?

AlanBateman avatar Oct 10 '24 05:10 AlanBateman

Thanks for the comments so far! Here I tried to reflect them: https://github.com/openjdk/jdk/pull/21431/commits/b7c871dab8357864b532a1f217ed26c3b40d50f4

(For ClassFileVersionsTest.java, it seemed unnecessarily complex to position the test cases into specific array positions, so I re-wrote that to use ArrayList. My goal was take the focus of the data preparation from how to place the test cases into the correct buckets, and more to the data. I kept pre-sizing of the ArrayList to avoid resizing it, although I could see an argument to remove that as well.)

lahodaj avatar Oct 10 '24 11:10 lahodaj

/label -build

magicus avatar Oct 11 '24 14:10 magicus

@magicus The build label was successfully removed.

openjdk[bot] avatar Oct 11 '24 14:10 openjdk[bot]

@lahodaj this pull request can not be integrated into master due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout JDK-8335989
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push

openjdk[bot] avatar Oct 11 '24 14:10 openjdk[bot]

/integrate

lahodaj avatar Nov 14 '24 06:11 lahodaj

Going to push as commit 1e97c1c913220b07ff0c1c977cea80bc9436729d. Since your change was applied there have been 26 commits pushed to the master branch:

  • e7d90b941fff095f4b1555020c09270d201c7402: 8343460: ZGC: Crash in ZRemembered::scan_page_and_clear_remset
  • 95a00f8a188048952871a10dc428566b18b91cb8: 8343875: Minor improvements of jpackage test library
  • 90e92342fc26db4876e22e8379a2c803c9de232c: 8344074: RISC-V: C1: More accurate _exception_handler_size and _deopt_handler_size
  • 3b283543c33df8c225e10b9186b7bc3cefd1a347: 8339288: Improve diagnostic logging runtime/cds/DeterministicDump.java
  • 0dab920b70560a5aea8b068080655a292908b646: 8343984: Fix Unsafe address overflow
  • 168b18ec68dd5488704cf76895d2449cd86428a6: 8343958: Remove security manager impl in java.lang.Process and java.lang.Runtime.exec
  • 5ac330b1ac81e932924e0ea10988f2536352be04: 8344039: Remove security manager dependency in java.time
  • 1eb38c8eb7ca12b370f8ae68988890eaf36c5b37: 8343219: Manual clientlibs test failures after SM removal
  • dde6230751672bde5a1bcb52686641f3a8b40cfb: 8343416: CDS dump fails when unregistered class can also be loaded from system modules
  • ffea9809a72777fd6bfac5d0052c7db676aa20d1: 8344023: Unnecessary Hashtable usage in LdapClient.defaultBinaryAttrs
  • ... and 16 more: https://git.openjdk.org/jdk/compare/79345bbbae2564f9f523859d1227a1784293b20f...master

Your commit was automatically rebased without conflicts.

openjdk[bot] avatar Nov 14 '24 06:11 openjdk[bot]

@lahodaj Pushed as commit 1e97c1c913220b07ff0c1c977cea80bc9436729d.

:bulb: You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

openjdk[bot] avatar Nov 14 '24 06:11 openjdk[bot]