<i18n dev> RFR: 8282819: Deprecate Locale class constructors [v3]

Roger Riggs rriggs at openjdk.java.net
Mon Mar 28 21:09:43 UTC 2022


On Mon, 28 Mar 2022 16:00:14 GMT, Naoto Sato <naoto at openjdk.org> wrote:

>> src/java.base/share/classes/java/util/Locale.java line 819:
>> 
>>> 817:      * @since 19
>>> 818:      */
>>> 819:     public static Locale of(String... fields) {
>> 
>> Arguably, there should be `Locale.of` overloads taking 0 to 4 arguments, so that it’s not necessary to box the fields in a `String` array.
>
> While it is true for completeness, I would limit the addition of new method as little as possible, because there are already several ways to obtain a Locale object.

As with other varargs method calls, it is possible to pass an array with the values.
I think it would be useful to describe the arguments as using the varargs nomenclature and indicate
the values are in the array.  For example, the `java.util.List.of(E... elements)` method is explicit 
about the array. Anther API using varargs EnumSet.

-------------

PR: https://git.openjdk.java.net/jdk/pull/7947


More information about the i18n-dev mailing list