-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
8290353: ModuleReader::list specification should suggest closing the returned stream #9538
Conversation
This commit adds additional clarification to the javadocs of ModuleReader::list about needing to close the stream. The new wording is similar to that used in Files::find and other similar methods.
👋 Welcome back rjernst! A progress list of the required criteria for merging this PR into |
Webrevs
|
@@ -213,9 +213,17 @@ default void release(ByteBuffer bb) { | |||
* when using the stream to list the module contents and access is denied | |||
* by the security manager. </p> | |||
* | |||
* <p> The returned stream contains references to one or more open directories | |||
* in the module. The directories are closed by closing the stream. </p> |
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.
This mostly looks good - I agree with adding the note here. Should the wording be relaxed a little - replace "contains references" with "may contain references" - since the stream will not always contain references to open directories - it depends on the type of reader. The end result / guidance is the same - use in a try-with-resources block - I'm just suggesting a slight relaxing of the wording.
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.
"may contain references" is good. I agree that the wordings should be relaxed a little. Similar for the apiNote.
* <p> The behavior of the stream when used after the module reader is | ||
* closed is implementation specific and therefore not specified. </p> | ||
* | ||
* @apiNote | ||
* This method must be used within a try-with-resources statement or similar | ||
* control structure to ensure that the stream's open directories are closed |
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.
Similar to my other comment - should "must' be replaced with "should" - for the same aforementioned reason.
Given the recommendation to close streams returned by the |
It’s odd to mix adding some advice to the Javadoc with adopting that advice in the code base. Consider opening a new issue and PR for the actual code changes. Also, a better summary for this issue (and PR) would be “ModuleReader::list specification should suggest closing the returned stream,” since that’s the essence of it. |
JDK-8290504 has been filed to track the implementation changes. @rjernst please separate out the implementation changes into a separate PR, using 8290504 as the linked JIRA issue. (apologies, I previously asked for the implementation changes to be in this PR )
Agreed. I updated the JIRA issue summary as suggested. @rjernst please update the title of this PR to match. |
/csr |
The following CSR has been filed for this issue, https://bugs.openjdk.org/browse/JDK-8290521. Please review. |
@ChrisHegarty this pull request will not be integrated until the CSR request JDK-8290521 for issue JDK-8290353 has been approved. |
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
Looks good to me. I reviewed the CSR. |
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.
Ship it!
@rjernst 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 14 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. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@ChrisHegarty, @mlchung, @mbreinhold, @jaikiran) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
Hello Ryan, the change looks fine to me. Please update the copyright year on the ModuleReader.java file, from 2020 to 2022. |
/integrate |
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.
Thank you Ryan for the copyright change. Looks fine to me.
/sponsor |
Going to push as commit db1e44c.
Your commit was automatically rebased without conflicts. |
@ChrisHegarty @rjernst Pushed as commit db1e44c. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
This commit adds additional clarification to the javadocs of
ModuleReader::list about needing to close the stream. The new wording is
similar to that used in Files::find and other similar methods.
Progress
Issues
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/9538/head:pull/9538
$ git checkout pull/9538
Update a local copy of the PR:
$ git checkout pull/9538
$ git pull https://git.openjdk.org/jdk pull/9538/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 9538
View PR using the GUI difftool:
$ git pr show -t 9538
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/9538.diff