-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
Conversation
👋 Welcome back jlahoda! A progress list of the required criteria for merging this PR into |
@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:
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
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 |
/jep JDK-8344700 |
@lahodaj |
/csr needed |
@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. |
Webrevs
|
There was a problem hiding this 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", |
There was a problem hiding this comment.
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?
…base; for all classfile versions; java.se no longer participates in preview.
@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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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!
There was a problem hiding this 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"; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lg
@lahodaj this pull request can not be integrated into 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 |
There was a problem hiding this 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; |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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?)
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
/integrate |
Going to push as commit 0a697f6.
Your commit was automatically rebased without conflicts. |
This is a patch to finalize the module imports feature. Please see:
https://bugs.openjdk.org/browse/JDK-8344700
Progress
Issues
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