RFR: 8311943: Cleanup usages of toLowerCase() and toUpperCase() in java.base [v2]

Glavo duke at openjdk.org
Wed Jul 12 16:22:15 UTC 2023


On Wed, 12 Jul 2023 16:05:03 GMT, Uwe Schindler <uschindler at openjdk.org> wrote:

> Maybe a small suggestion to make it clear whats wanted here. In other projects I am involved in (Apache Lucene/Solr, Apache TIKA, PostgresSQL JDBC, Checkstyle itsself, Elasticserach/Opensearch), which use the [forbiddenapis Maven/Gradle/Ant plugin](https://github.com/policeman-tools/forbidden-apis/), we forbid all calls to several Java APIs (including toLowerCase/toUpperCase case). All bytecode using this will build failure (FYI, we also disallow other stuff like relying of default timezone or characterset). To make it clear what is really intended, those projects agreed on having `toLowerCase(Locale.getDefault())`, so it is explicit what's wanted. Without that it could be that somebody else starts the discussion again.
> 
> This is just a suggestion to be explicit as it makes maintaining the code easier.

I agree with this.

I'm working on deprecating `toLowerCase()` and `toUpperCase()`, this PR is part of that effort. I wish to convert all use cases of them to `toLowerCase(Locale)` and `toUpperCase(Locale)`.

More backstory is detailed in https://github.com/openjdk/jdk/pull/13434#issuecomment-1503989660.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14763#discussion_r1261421937



More information about the security-dev mailing list