-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8340082: Use inline return tag in java.base #20981
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 |
|
@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 13 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 |
|
@jddarcy The following labels will be automatically applied to this pull request:
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. |
ExE-Boss
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.
The old version of the doc comments had a . at the end of the first sentence:
| /** | ||
| * Returns the pattern used to create this filter. | ||
| * @return the pattern used to create this filter | ||
| * {@return the pattern used to create this filter} |
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.
| * {@return the pattern used to create this filter} | |
| * {@return the pattern used to create this filter}. |
| /** | ||
| * Returns the number of bytes read from the input stream. | ||
| * @return the number of bytes read from the input stream | ||
| * {@return the number of bytes read from the input stream} |
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.
| * {@return the number of bytes read from the input stream} | |
| * {@return the number of bytes read from the input stream}. |
| /** | ||
| * Returns the retention policy. | ||
| * @return the retention policy | ||
| * {@return the retention policy} |
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.
| * {@return the retention policy} | |
| * {@return the retention policy}. |
| /** | ||
| * Returns the length of the input. | ||
| * @return the length of the input | ||
| * {@return the length of the input} |
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.
| * {@return the length of the input} | |
| * {@return the length of the input}. |
| /** | ||
| * Returns the message. | ||
| * @return the message | ||
| * {@return the message} |
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.
| * {@return the message} | |
| * {@return the message}. |
| * {@return true if the end of the compressed data stream has been | ||
| * reached} |
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.
| * {@return true if the end of the compressed data stream has been | |
| * reached} | |
| * {@return true if the end of the compressed data stream has been | |
| * reached}. |
| /** | ||
| * Returns the ADLER-32 value of the uncompressed data. | ||
| * @return the ADLER-32 value of the uncompressed data | ||
| * {@return the ADLER-32 value of the uncompressed data} |
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.
| * {@return the ADLER-32 value of the uncompressed data} | |
| * {@return the ADLER-32 value of the uncompressed data}. |
| /** | ||
| * Returns the name of the entry. | ||
| * @return the name of the entry | ||
| * {@return the name of the entry} |
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.
| * {@return the name of the entry} | |
| * {@return the name of the entry}. |
| /** | ||
| * Returns the path name of the ZIP file. | ||
| * @return the path name of the ZIP file | ||
| * {@return the path name of the ZIP file} |
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.
| * {@return the path name of the ZIP file} | |
| * {@return the path name of the ZIP file}. |
| /** | ||
| * Returns an enumeration of the ZIP file entries. | ||
| * @return an enumeration of the ZIP file entries | ||
| * {@return an enumeration of the ZIP file entries} |
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.
| * {@return an enumeration of the ZIP file entries} | |
| * {@return an enumeration of the ZIP file entries}. |
The new version has it too, but in the final, generated form: https://docs.oracle.com/en/java/javase/22/docs/specs/javadoc/doc-comment-spec.html#return
|
pavelrappo
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.
Thanks, Joe. This looks good, especially considering that the change was produced with the help of a quick-and-dirty, regex-based script. This change is certainly enough to spread awareness of this relatively new javadoc feature.
I remember I had a more involved script that used javax.lang.model and string similarity metrics. That script captured a lot more candidates for {@return}. But on the other hand, once you start considering non-exact matches, it requires human judgement and increases review effort.
Separately, this PR has helped me put a finger on what I don't like about {@return}. What I don't like is the generated HTML. {@return} saves mental effort when reading raw javadoc in source, but it provides no similar service to the reader of the final, HTML form. Maybe it's just me, but it looks needlessly bloated and silly:
Maybe if a method's main description consisted only of {@return}, we could skip the first sentence in the "Method Details" section and just output Returns:? Any further discussion should happen on the javadoc-dev mailing list.
LanceAndersen
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.
I went through the changes and they look fine.
|
This patch only captures one-line returns without extra sentences. Is it possible for us to handle slightly more complex documentations like
|
Sure, it is possible. However, there's a tradeoff between comprehensiveness and the effort required. Joe's script provides a lot for a little. If there's interest in it, we could file follow-up bugs to fix more cases with more powerful tools. |
naotoj
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.
java.nio.charset and java.time.format changes look good
Yes, the quick and dirty program is only a "minimum viable product" level of functionality. It is not complete and doesn't catch all cases. Future improvements welcome! |
liach
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. It might be feasible to run a more complex tool that analyzes the tokenized javadoc AST from javac as later work.
Annotation changes look good.
|
/integrate |
|
Going to push as commit 89c172a.
Your commit was automatically rebased without conflicts. |
Candidates for this refactoring were found programmatically; the program to find candidates is in a comment on the bug.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/20981/head:pull/20981$ git checkout pull/20981Update a local copy of the PR:
$ git checkout pull/20981$ git pull https://git.openjdk.org/jdk.git pull/20981/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 20981View PR using the GUI difftool:
$ git pr show -t 20981Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/20981.diff
Webrev
Link to Webrev Comment