Draft: Deprecate toLowerCase()/toUpperCase() and provide locale insensitive alternative
Archie Cobbs
archie.cobbs at gmail.com
Tue Apr 11 22:32:45 UTC 2023
On Tue, Apr 11, 2023 at 4:52 PM Glavo <zjx001202 at gmail.com> wrote:
> i'm not sure that the methods lowercase() and uppercase() are a good
>> addition.
>> Their names are too close to toLowerCase/toUpperCase thus too easy to
>> misuse ones for the others.
>>
>
> I'm fine with users having to write toLowerCase(Locale.ROOT) or
>> toUpperCase(Locale.Root) because this is already what we teach.
>
>
> This is the current situation, but I don't think it is good.
>
> This idiom forces users to import Locale even in locale-insensitive
> scenarios.
>
Possible compromise? How about toUpper() and toLower()?
This would be consistent with the trend whereby newer replacement names
tend to be less verbose (e.g., Enumeration.hasMoreElements() ->
Iterator.hasNext()), while also being different enough that people
shouldn't mistake them for something that already exists, and will
understand that they must mean something new.
-Archie
--
Archie L. Cobbs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20230411/bda2fc36/attachment.htm>
More information about the core-libs-dev
mailing list