Skip to content

Commit 67f590d

Browse files
author
Justin Lu
committed
8381681: Clarify locale usage in Javadoc for the Locale display methods
Reviewed-by: naoto
1 parent 1e2aa61 commit 67f590d

1 file changed

Lines changed: 31 additions & 28 deletions

File tree

src/java.base/share/classes/java/util/Locale.java

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1932,7 +1932,7 @@ public String getISO3Country() throws MissingResourceException {
19321932
}
19331933

19341934
/**
1935-
* Returns a name for the locale's language that is appropriate for display to the
1935+
* Returns a name for {@code this} locale's language that is appropriate for display to the
19361936
* user.
19371937
* If possible, the name returned will be localized for the default
19381938
* {@link Locale.Category#DISPLAY DISPLAY} locale.
@@ -1946,14 +1946,15 @@ public String getISO3Country() throws MissingResourceException {
19461946
* this function falls back on the English name, and uses the ISO code as a last-resort
19471947
* value. If the locale doesn't specify a language, this function returns the empty string.
19481948
*
1949-
* @return The name of the display language.
1949+
* @return The name of the display language appropriate to the default
1950+
* {@link Locale.Category#DISPLAY DISPLAY} locale.
19501951
*/
1951-
public final String getDisplayLanguage() {
1952+
public String getDisplayLanguage() {
19521953
return getDisplayLanguage(getDefault(Category.DISPLAY));
19531954
}
19541955

19551956
/**
1956-
* Returns a name for the locale's language that is appropriate for display to the
1957+
* Returns a name for {@code this} locale's language that is appropriate for display to the
19571958
* user.
19581959
* If possible, the name returned will be localized according to inLocale.
19591960
* For example, if the locale is fr_FR and inLocale
@@ -1964,7 +1965,7 @@ public final String getDisplayLanguage() {
19641965
* on the ISO code as a last-resort value. If the locale doesn't specify a language,
19651966
* this function returns the empty string.
19661967
*
1967-
* @param inLocale The locale for which to retrieve the display language.
1968+
* @param inLocale The locale in which to localize the display language.
19681969
* @return The name of the display language appropriate to the given locale.
19691970
* @throws NullPointerException if {@code inLocale} is {@code null}
19701971
*/
@@ -1973,28 +1974,27 @@ public String getDisplayLanguage(Locale inLocale) {
19731974
}
19741975

19751976
/**
1976-
* Returns a name for the locale's script that is appropriate for display to
1977+
* Returns a name for {@code this} locale's script that is appropriate for display to
19771978
* the user. If possible, the name will be localized for the default
19781979
* {@link Locale.Category#DISPLAY DISPLAY} locale. Returns
19791980
* the empty string if this locale doesn't specify a script code.
19801981
*
1981-
* @return the display name of the script code for the current default
1982-
* {@link Locale.Category#DISPLAY DISPLAY} locale
1982+
* @return The display name of the script code appropriate to the default
1983+
* {@link Locale.Category#DISPLAY DISPLAY} locale.
19831984
* @since 1.7
19841985
*/
19851986
public String getDisplayScript() {
19861987
return getDisplayScript(getDefault(Category.DISPLAY));
19871988
}
19881989

19891990
/**
1990-
* Returns a name for the locale's script that is appropriate
1991+
* Returns a name for {@code this} locale's script that is appropriate
19911992
* for display to the user. If possible, the name will be
19921993
* localized for the given locale. Returns the empty string if
19931994
* this locale doesn't specify a script code.
19941995
*
1995-
* @param inLocale The locale for which to retrieve the display script.
1996-
* @return the display name of the script code for the current default
1997-
* {@link Locale.Category#DISPLAY DISPLAY} locale
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.
19981998
* @throws NullPointerException if {@code inLocale} is {@code null}
19991999
* @since 1.7
20002000
*/
@@ -2003,7 +2003,7 @@ public String getDisplayScript(Locale inLocale) {
20032003
}
20042004

20052005
/**
2006-
* Returns a name for the locale's country that is appropriate for display to the
2006+
* Returns a name for {@code this} locale's country that is appropriate for display to the
20072007
* user.
20082008
* If possible, the name returned will be localized for the default
20092009
* {@link Locale.Category#DISPLAY DISPLAY} locale.
@@ -2017,14 +2017,15 @@ public String getDisplayScript(Locale inLocale) {
20172017
* this function falls back on the English name, and uses the ISO code as a last-resort
20182018
* value. If the locale doesn't specify a country, this function returns the empty string.
20192019
*
2020-
* @return The name of the country appropriate to the locale.
2020+
* @return The name of the country appropriate to the default
2021+
* {@link Locale.Category#DISPLAY DISPLAY} locale.
20212022
*/
2022-
public final String getDisplayCountry() {
2023+
public String getDisplayCountry() {
20232024
return getDisplayCountry(getDefault(Category.DISPLAY));
20242025
}
20252026

20262027
/**
2027-
* Returns a name for the locale's country that is appropriate for display to the
2028+
* Returns a name for {@code this} locale's country that is appropriate for display to the
20282029
* user.
20292030
* If possible, the name returned will be localized according to inLocale.
20302031
* For example, if the locale is fr_FR and inLocale
@@ -2035,7 +2036,7 @@ public final String getDisplayCountry() {
20352036
* on the ISO code as a last-resort value. If the locale doesn't specify a country,
20362037
* this function returns the empty string.
20372038
*
2038-
* @param inLocale The locale for which to retrieve the display country.
2039+
* @param inLocale The locale in which to localize the display country.
20392040
* @return The name of the country appropriate to the given locale.
20402041
* @throws NullPointerException if {@code inLocale} is {@code null}
20412042
*/
@@ -2061,23 +2062,24 @@ private String getDisplayString(String code, String cat, Locale inLocale, int ty
20612062
}
20622063

20632064
/**
2064-
* Returns a name for the locale's variant code that is appropriate for display to the
2065+
* Returns a name for {@code this} locale's variant code that is appropriate for display to the
20652066
* user. If possible, the name will be localized for the default
20662067
* {@link Locale.Category#DISPLAY DISPLAY} locale. If the locale
20672068
* doesn't specify a variant code, this function returns the empty string.
20682069
*
2069-
* @return The name of the display variant code appropriate to the locale.
2070+
* @return The name of the display variant code appropriate to the default
2071+
* {@link Locale.Category#DISPLAY DISPLAY} locale.
20702072
*/
2071-
public final String getDisplayVariant() {
2073+
public String getDisplayVariant() {
20722074
return getDisplayVariant(getDefault(Category.DISPLAY));
20732075
}
20742076

20752077
/**
2076-
* Returns a name for the locale's variant code that is appropriate for display to the
2078+
* Returns a name for {@code this} locale's variant code that is appropriate for display to the
20772079
* user. If possible, the name will be localized for inLocale. If the locale
20782080
* doesn't specify a variant code, this function returns the empty string.
20792081
*
2080-
* @param inLocale The locale for which to retrieve the display variant code.
2082+
* @param inLocale The locale in which to localize the display variant code.
20812083
* @return The name of the display variant code appropriate to the given locale.
20822084
* @throws NullPointerException if {@code inLocale} is {@code null}
20832085
*/
@@ -2098,7 +2100,7 @@ public String getDisplayVariant(Locale inLocale) {
20982100
}
20992101

21002102
/**
2101-
* Returns a name for the locale that is appropriate for display to the
2103+
* Returns a name for {@code this} locale that is appropriate for display to the
21022104
* user. This will be the values returned by getDisplayLanguage(),
21032105
* getDisplayScript(), getDisplayCountry(), getDisplayVariant() and
21042106
* optional {@linkplain ##def_locale_extension Unicode extensions}
@@ -2116,14 +2118,15 @@ public String getDisplayVariant(Locale inLocale) {
21162118
* be localized depending on the locale. If the language, script, country,
21172119
* and variant fields are all empty, this function returns the empty string.
21182120
*
2119-
* @return The name of the locale appropriate to display.
2121+
* @return The display name appropriate to the default
2122+
* {@link Locale.Category#DISPLAY DISPLAY} locale.
21202123
*/
2121-
public final String getDisplayName() {
2124+
public String getDisplayName() {
21222125
return getDisplayName(getDefault(Category.DISPLAY));
21232126
}
21242127

21252128
/**
2126-
* Returns a name for the locale that is appropriate for display
2129+
* Returns a name for {@code this} locale that is appropriate for display
21272130
* to the user. This will be the values returned by
21282131
* getDisplayLanguage(), getDisplayScript(), getDisplayCountry(),
21292132
* getDisplayVariant(), and optional {@linkplain ##def_locale_extension
@@ -2142,8 +2145,8 @@ public final String getDisplayName() {
21422145
* be localized depending on the locale. If the language, script, country,
21432146
* and variant fields are all empty, this function returns the empty string.
21442147
*
2145-
* @param inLocale The locale for which to retrieve the display name.
2146-
* @return The name of the locale appropriate to display.
2148+
* @param inLocale The locale in which to localize the display name.
2149+
* @return The display name appropriate to the given locale.
21472150
* @throws NullPointerException if {@code inLocale} is {@code null}
21482151
*/
21492152
public String getDisplayName(Locale inLocale) {

0 commit comments

Comments
 (0)