RFR: 8229283: StringLatin1 should consistently use CharacterDataLatin1.instance when applicable
Brent Christian
brent.christian at oracle.com
Fri Aug 9 23:22:38 UTC 2019
Hi Claes,
Some observations:
394 int u1 = CharacterDataLatin1.instance.toUpperCase(c1);
395 int u2 = CharacterDataLatin1.instance.toUpperCase(c2);
Changing u1 & u2 from char -> int, L399 now calls toLowerCase(int)
instead of toLowerCase(char). Should be fine, though. Speaking of:
399 if (Character.toLowerCase(u1) == Character.toLowerCase(u2)) {
Should/could this line also be changed?
421 if (Character.toLowerCase(u1) == Character.toLowerCase(u2)) {
Similarly, maybe Character.toLowerCase(u1) ->
CharacterDataLatin1.instance.toUpperCase(u1) ?
477 lowerChar = CharacterDataLatin1.instance.toLowerCase(srcChar);
...
Initially I was nervous about the lower/upper case changes, but I've
convinced myself that StringLatin1 handles these cases correctly.
FWIW, the changes from Character.toUpperCaseEx() (e.g. L512) now skip:
assert isValidCodePoint(codePoint);
and changes from Character.toUpperCaseCharArray() (e.g. L562) now skip:
assert isBmpCodePoint(codePoint);
in Character.java.
Thanks,
-Brent
More information about the core-libs-dev
mailing list