-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8320919: Clarify Locale related system properties #17065
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
8320919: Clarify Locale related system properties #17065
Conversation
👋 Welcome back naoto! A progress list of the required criteria for merging this PR into |
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.
LGTM; left some minor wording comments.
* of the Java runtime and established in the following three phases: | ||
* <ol> | ||
* <li>The locale-related system properties listed below are established from the | ||
* host environment. Some system properties (except for {@code user.language}) may |
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.
IIUC, should it be all system properties, not some if we are defining the single exception?
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 host-dependent part of the code always generates at least the language, thus it was excluded.
* at startup time. If the overriding value of the {@code user.extensions} property | ||
* is unparsable, it is ignored. The overriding values of other properties are not | ||
* checked for syntax or validity and are used directly in the default Locale. | ||
* (Typically, system property values can be provided using the {@code -D} command-line |
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.
Do these last two sentences need to be enclosed in a parentheses? It seems pretty important as it is the main way to override the properties via command-line.
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 -D
command-line option is not a part of the Java SE specification but an allowed behavior, so it may not be a normative description 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.
Right, I suggested putting that in parentheses. Historically we haven't been very formal about distinguishing between normative (Java SE) specifications and informative text that talks about implementations. In this case I felt that enclosing the text in parentheses and also adding hedging words ("typically") made it clear that this text isn't normative.
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.
FWIW, for the FFM API, we describe the --enable-native-access
command line flag in a separate @implNote
:
jdk/src/java.base/share/classes/java/lang/foreign/package-info.java
Lines 164 to 171 in cf94854
* @implNote | |
* In the reference implementation, access to restricted methods can be granted to | |
* specific modules using the command line option {@code --enable-native-access=M1,M2, ... Mn}, | |
* where {@code M1}, {@code M2}, {@code ... Mn} are module names (for the unnamed module, | |
* the special value {@code ALL-UNNAMED} can be used). If this option is specified, | |
* access to restricted methods are only granted to the modules listed by that option. | |
* If this option is not specified, access to restricted methods is enabled for all | |
* modules, but access to restricted methods will result in runtime warnings. |
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 suggestion, Jorn. I tried embedding @implNote
within the ordered list, but looks like it is not allowed. It would be nice if we could use it inside a list, but since it is about overriding the property values, I would rather not have the description apart from that list item.
* {@code -Duser.language=foobarbaz} results in a default Locale whose language is | ||
* "foobarbaz".) | ||
* </li> | ||
* <li>The default {@code Locale} instance is constructed from these system |
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.
Might read better as "... is constructed from the values of these system properties."
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. modified
* Locale with {@link #getDefault()} and change it with {@link #setDefault(Locale)}. | ||
* If the default Locale is changed with {@link #setDefault(Locale)}, the corresponding | ||
* system properties are not altered. It is not recommended that applications read | ||
* these system properties and parse/interpret them as their values may be out of sync. |
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.
Small wordsmithing: I would say "out of date" instead.
* These category specific default Locales can be queried by {@link #getDefault(Category)}, | ||
* and set by {@link #setDefault(Category, Locale)}. Construction of these category | ||
* specific default Locales are determined by the corresponding system properties, | ||
* which consist of the base system properties as listed above, appended by either |
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.
"appended" => "suffixed"
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, with a couple small wording changes.
Thanks, Stuart. Modified the wordings as suggested. |
* Locale with {@link #getDefault()} and change it with {@link #setDefault(Locale)}. | ||
* If the default Locale is changed with {@link #setDefault(Locale)}, the corresponding | ||
* system properties are not altered. It is not recommended that applications read | ||
* these system properties and parse/interpret them as their values may be out of date. |
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.
"parse/interpret" -> "parse or interpret".
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, Roger. Modified.
* option of a launcher. For example, specifying {@code -Duser.extensions=foobarbaz} | ||
* results in a default Locale with no extensions, while specifying | ||
* {@code -Duser.language=foobarbaz} results in a default Locale whose language is | ||
* "foobarbaz".) |
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 parenthesized sentence is so long that its not effective in making it seem like an option.
The "Typical," is sufficient to indicate it is not part of the spec. Drop the parens.
@@ -258,6 +259,74 @@ | |||
* locales. For example, {@code Locale.US} is the {@code Locale} object | |||
* for the United States. | |||
* | |||
* <h3><a id="default_locale">Default Locale</a></h3> | |||
* | |||
* <p>The default Locale is mainly provided for any locale-sensitive methods if no |
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 word "mainly" can be omitted, it doesn't add any clarity.
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.
Removed.
* {@code language} part of the default Locale for {@link Locale.Category#DISPLAY} | ||
* category. In the absence of category specific system properties, the "category-less" |
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.
"...part of the default Locale for the Locale.Category#DISPLAY category."
?
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, Brent. Inserted the
Co-authored-by: Justin Lu <Justin.lu@oracle.com>
Co-authored-by: Justin Lu <Justin.lu@oracle.com>
Co-authored-by: Justin Lu <Justin.lu@oracle.com>
Co-authored-by: Justin Lu <Justin.lu@oracle.com>
e67585e
to
4a76c89
Compare
@naotoj Please do not rebase or force-push to an active PR as it invalidates existing review comments. Note for future reference, the bots always squash all changes into a single commit automatically as part of the integration. See OpenJDK Developers’ Guide for more information. |
@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 160 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 |
/integrate |
Going to push as commit 376051a.
Your commit was automatically rebased without conflicts. |
This is a doc change to clarify what the
Default Locale
is, and how it is established during the system startup using the system properties. Those locale-related system properties have existed since the early days of Java, but have never been publicly documented before. It is also the intention of this PR to clarify those system properties and how they are overridden. A corresponding CSR has been drafted.Progress
Issues
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/17065/head:pull/17065
$ git checkout pull/17065
Update a local copy of the PR:
$ git checkout pull/17065
$ git pull https://git.openjdk.org/jdk.git pull/17065/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 17065
View PR using the GUI difftool:
$ git pr show -t 17065
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/17065.diff
Webrev
Link to Webrev Comment