Skip to content

8344708: Implement JEP 511: Module Import Declarations #23801

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 14 commits into from

Conversation

lahodaj
Copy link
Contributor

@lahodaj lahodaj commented Feb 26, 2025

This is a patch to finalize the module imports feature. Please see:
https://bugs.openjdk.org/browse/JDK-8344700


Progress

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

Issues

  • JDK-8344708: Implement JEP 511: Module Import Declarations (Sub-task - P4)
  • JDK-8344700: JEP 511: Module Import Declarations (JEP)
  • JDK-8350781: Compiler Implementation of Module Import Declarations (CSR)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 23801

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 26, 2025

👋 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.

@openjdk
Copy link

openjdk bot commented Feb 26, 2025

@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:

8344708: Implement JEP 511: Module Import Declarations

Reviewed-by: mcimadamore, vromero, 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 67 new commits pushed to the master branch:

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.

@lahodaj
Copy link
Contributor Author

lahodaj commented Feb 26, 2025

/jep JDK-8344700
/csr needed

@openjdk
Copy link

openjdk bot commented Feb 26, 2025

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

  • compiler
  • core-libs
  • kulla

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
Copy link

openjdk bot commented Feb 26, 2025

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

@openjdk openjdk bot added the jep label Feb 26, 2025
@lahodaj
Copy link
Contributor Author

lahodaj commented Feb 26, 2025

/csr needed

@openjdk openjdk bot added the csr Pull request needs approved CSR before integration label Feb 26, 2025
@openjdk
Copy link

openjdk bot commented Feb 26, 2025

@lahodaj has indicated that a compatibility and specification (CSR) request is needed for this pull request.

@lahodaj please create a CSR request for issue JDK-8344708 with the correct fix version. This pull request cannot be integrated until the CSR request is approved.

@openjdk
Copy link

openjdk bot commented Feb 26, 2025

@lahodaj an approved CSR request is already required for this pull request.

@lahodaj lahodaj marked this pull request as ready for review March 4, 2025 11:27
@openjdk openjdk bot added the rfr Pull request is ready for review label Mar 4, 2025
@mlbridge
Copy link

mlbridge bot commented Mar 4, 2025

Copy link
Contributor

@vicente-romero-oracle vicente-romero-oracle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks sensible

.callback(verifyJavaSEDependency(true, seenJavaSEDependency))
.files(findJavaFiles(src))
.run(Task.Expect.FAIL)
.writeAll()
.getOutputLines(Task.OutputKind.DIRECT);

List<String> expected = List.of(
"Test.java:2:8: compiler.err.preview.feature.disabled.plural: (compiler.misc.feature.module.imports)",
"Test.java:2:8: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.module.imports), 24, 25",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't there a similar test above?

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 1, 2025

@lahodaj This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

static Startup defaultStartup(boolean preview, MessageHandler mh) {
int idx = preview ? 1 : 0;
static Startup defaultStartup(int sourceLevel, boolean preview, MessageHandler mh) {
boolean startup24 = sourceLevel < 25;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we use a constant here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there should be a constant. Done here:
d66703c
Thanks!

Copy link
Contributor

@vicente-romero-oracle vicente-romero-oracle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

flagName = "ACC_TRANSITIVE";
}
&& mods.contains(Requires.Modifier.STATIC)) {
String flagName = "ACC_STATIC_PHASE";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A minor comment on the style here, do you mind combin L413+414 as it will make it easier to read. The change is okay of course.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did this:
029e0dd
Please let me know if something more/different is needed.

Copy link
Contributor

@vicente-romero-oracle vicente-romero-oracle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lg

@openjdk
Copy link

openjdk bot commented Apr 24, 2025

@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-8344708
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 openjdk bot added the merge-conflict Pull request has merge conflict with target branch label Apr 24, 2025
@openjdk openjdk bot removed the merge-conflict Pull request has merge conflict with target branch label Apr 28, 2025
Copy link
Contributor

@vicente-romero-oracle vicente-romero-oracle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Source source = Source.lookup(sourceLevel);
boolean hasModuleImports = source == null ||
Feature.MODULE_IMPORTS.allowedInSource(source);
int idx = preview ? 2 : !hasModuleImports ? 1 : 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels like this would be cleaner with an if/else if/else? I'm also not a big fan of hardcoded constants into an array. Maybe this code can benefit from stable values (when they are integrated).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(in the interim, maybe using an enum with the possible values, instead of indices, and then turning defaultStartup into an EnumMap might make the code slightly clearer?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the comments, attempted to fix here:
4f95755

@@ -186,6 +194,13 @@ String fullClassNameAndPackageToClass(String full, String pkg) {
if (Stream.concat(Stream.of("java.lang"), pkgs).anyMatch(pkg::equals)) {
return full.substring(pkg.length() + 1);
}
Stream<String> mods = importSnippets()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this variable be called mods ? AFAIU, it lists all the packages exported by a module.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, attempted to improve here:
4f95755

@openjdk openjdk bot removed the jep label Apr 29, 2025
@lahodaj lahodaj changed the title 8344708: Compiler Implementation of Module Import Declarations 8344708: Implement JEP 511: Module Import Declarations Apr 30, 2025
@openjdk openjdk bot added ready Pull request is ready to be integrated and removed csr Pull request needs approved CSR before integration labels May 1, 2025
@lahodaj
Copy link
Contributor Author

lahodaj commented May 1, 2025

/integrate

@openjdk
Copy link

openjdk bot commented May 1, 2025

Going to push as commit 0a697f6.
Since your change was applied there have been 69 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label May 1, 2025
@openjdk openjdk bot closed this May 1, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels May 1, 2025
@openjdk
Copy link

openjdk bot commented May 1, 2025

@lahodaj Pushed as commit 0a697f6.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants