String.toLowerCase() (and toUpperCase) without specifying a Locale can
have surprising results.
For example, if this is used on a device and the userâs Locale is TĂŒrkiye,
then "I".toLowerCase() will yield a lowercase dotless I (âıâ). This could be
extremely dangerous if you were expecting to operate on ASCII text to generate
machine-readable identifiers.
If this kind of regionalisation is desired, use
.toLowerCase(Locale.getDefault()) to make that explicit. If not,
.toLowerCase(Locale.ROOT) or .toLowerCase(Locale.ENGLISH) will give you
casing independent of the userâs current Locale. If you know that youâre
operating on ASCII, prefer Ascii.toLower/UpperCase to make that explicit.
Suppress false positives by adding the suppression annotation @SuppressWarnings("StringCaseLocaleUsage") to the enclosing element.