-
Notifications
You must be signed in to change notification settings - Fork 6.2k
JDK-8310571: Use inline @return tag on java.util.Objects #14608
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 darcy! A progress list of the required criteria for merging this PR into |
Webrevs
|
stuart-marks
left a comment
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 good. I had to refresh my understanding of the exact behavior of the inline @return tag:
https://docs.oracle.com/en/java/javase/17/docs/specs/javadoc/doc-comment-spec.html
(search for {@return)
It adds a leading "Returns " and a trailing "." to the block's text, and inserts a "Returns" section in the proper place. This seems oddly specific, but it's tailored for this exact use case. Anyway, good cleanup.
|
@jddarcy 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 3 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
|
I can see that |
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 doing this, Joe. It seems that I have made multiple comments on the same issue. It makes me wonder if that isn't an issue at all, but is a deliberate choice made in this PR.
| * {@return the result of calling {@code toString} on the first | ||
| * argument if the first argument is not {@code null} and returns | ||
| * the second argument otherwise. | ||
| * the second argument otherwise} |
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 "returns" in "and returns" feels non-DRY and brittle. We enclosed that word in {@return} already. Maybe we could use the wording from the original @return to avoid the verb altogether?
This is of course, a personal opinion.
| /** | ||
| * Returns {@code true} if the provided reference is {@code null} otherwise | ||
| * returns {@code false}. | ||
| * {@return {@code true} if the provided reference is {@code |
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.
See my previous comment on the "returns" verb in the doc comment for toString(Object, String). Here (IMO), you picked the better of the two options.
| * {@return the first argument if it is non-{@code null} and | ||
| * otherwise returns the non-{@code null} second argument} |
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.
Same comment for "returns".
| * {@return the first argument if it is non-{@code null} and otherwise | ||
| * returns the non-{@code null} value of {@code supplier.get()}} |
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.
Same.
|
/integrate |
|
Going to push as commit 0db63ec.
Your commit was automatically rebased without conflicts. |
Small cleanup, minor differences in the wording of portions of toString(Object, String), nonNull(Object), requireNonNullElse, and requireNonNullElseGet.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/14608/head:pull/14608$ git checkout pull/14608Update a local copy of the PR:
$ git checkout pull/14608$ git pull https://git.openjdk.org/jdk.git pull/14608/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 14608View PR using the GUI difftool:
$ git pr show -t 14608Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/14608.diff
Webrev
Link to Webrev Comment