RFR: 8311220: Optimization for StringLatin UpperLower

Glavo duke at openjdk.org
Mon Jul 3 09:27:53 UTC 2023


On Mon, 3 Jul 2023 09:21:54 GMT, 温绍锦 <duke at openjdk.org> wrote:

> another example:
> 
> ```
> String str0 = new String(new byte[]{-1}, StandardCharsets.ISO_8859_1);
> String str1 = str0.toUpperCase();
> ```
> 
> str0.coder is LATIN1 str1.coder is UTF16

I know this, these cases only happen with `toUpperCase`, not with `toLowerCase`, we can easily verify this:


jshell> for (int i = 0; i < 256; i++) if (Character.toUpperCase(i) > 0xFF) System.out.println(i);
181
255

jshell> for (int i = 0; i < 256; i++) if (Character.toLowerCase(i) > 0xFF) System.out.println(i);

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14751#discussion_r1250553279


More information about the core-libs-dev mailing list