-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
8330276: Console methods with explicit Locale #18923
8330276: Console methods with explicit Locale #18923
Conversation
👋 Welcome back naoto! A progress list of the required criteria for merging this PR into |
@naotoj 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 19 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 |
Webrevs
|
* the specified format string and arguments with the specified | ||
* {@code locale}. | ||
* | ||
* @param locale locale used for formatting |
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.
Specify the behavior when locale is null?
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.
Good point. Brought the same wording from String.format
* Arguments referenced by the format specifiers in the format | ||
* string. If there are more arguments than format specifiers, the | ||
* extra arguments are ignored. The number of arguments is | ||
* variable and may be zero. The maximum number of arguments is |
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.
readLine and readPassword don't have this statement (The number of arguments is variable and may be zero). Is this statement helpful for those methods as well?
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.
Modified each description for args
consistently.
Thanks, Joe. Addressed your points (and updated the test case accordingly) |
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 update. Changes look good to me.
@@ -83,9 +85,17 @@ public Reader reader() { | |||
* {@inheritDoc} | |||
*/ | |||
@Override | |||
public Console format(String fmt, Object ... args) { | |||
public Console format(String format, Object ... args) { | |||
return format(Locale.getDefault(Locale.Category.FORMAT), format, args); |
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.
Given the number of calls to Locale.getDefault(Locale.Category.FORMAT) it might be worthwhile to cache that in the Proxying Console or in the JdkConsoleImpl.
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.
Initially, I thought about it but did not cache it here because it is cached in the Locale
class, and the call returns the cached value.
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
/integrate |
@naotoj Since your change was applied there have been 86 commits pushed to the
It was not possible to rebase your changes automatically. Please merge |
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 to me.
/integrate |
Going to push as commit 7cff04f.
Your commit was automatically rebased without conflicts. |
The changeset included a workaround patch to the upstream JLine. An issue for it was created by Jan: jline/jline3#982 |
Proposing new overloaded methods in
java.io.Console
class that explicitly take aLocale
argument. Existing methods rely on the default locale, so the users won't be able to format their prompts/outputs in a certain locale explicitly.Progress
Issues
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/18923/head:pull/18923
$ git checkout pull/18923
Update a local copy of the PR:
$ git checkout pull/18923
$ git pull https://git.openjdk.org/jdk.git pull/18923/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 18923
View PR using the GUI difftool:
$ git pr show -t 18923
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/18923.diff
Webrev
Link to Webrev Comment