On Mon, 6 Apr 2026 17:39:17 GMT, Justin Lu <[email protected]> wrote: > This PR includes two changes. First, `Locale.getDisplayScript(Locale)` > incorrectly copies the return description of its sibling method > `Locale.getDisplayScript()`. It is corrected to describe the actual contract. > > Second, the `getDisplayXXX` methods are updated to better distinguish the > `Locale` from which the methods are invoked on versus the `Locale` which is > used for localization of the output. An example of this issue is the > following, > > `Locale.getDisplayCountry()` states it returns "The name of the country > appropriate to the locale." > `Locale.String getDisplayCountry(Locale inLocale)` states it returns "The > name of the country appropriate to the given locale." > > In the no-arg method, "locale" refers to `this`, while in the 1-arg method, > "locale" is `inLocale`. It would be more clear if the methods consistently > referred to the same "locale". i.e., either the one doing the localizing, or > the one from which the methods are invoked on.
LGTM. Left a minor comment src/java.base/share/classes/java/util/Locale.java line 1949: > 1947: * value. If the locale doesn't specify a language, this function > returns the empty string. > 1948: * > 1949: * @return The name of the display language appropriate to the > current default Not your wording, but I think we can remove "current" here (applies to other locations too) src/java.base/share/classes/java/util/Locale.java line 1997: > 1995: * > 1996: * @param inLocale The locale in which to localize the display > script. > 1997: * @return The display name of the script code appropriate to the > given locale. Thanks for catching this! My bad. ------------- PR Review: https://git.openjdk.org/jdk/pull/30590#pullrequestreview-4064944427 PR Review Comment: https://git.openjdk.org/jdk/pull/30590#discussion_r3042085257 PR Review Comment: https://git.openjdk.org/jdk/pull/30590#discussion_r3042086948
