On Fri, 14 Aug 2026 13:58:59 GMT, Tatsunori Uchino <[email protected]> wrote:

>> Adds `codePointCount()` overloads to `String`, `Character`, 
>> `(Abstract)StringBuilder`, and `StringBuffer` to make it possible to 
>> conveniently retrieve the length of a string as code points without extra 
>> boundary checks.
>> 
>> 
>> if (superTremendouslyLongExpressionYieldingAString().codePointCount() > 
>> limit) {
>>     throw new Exception("exceeding length");
>> }
>> 
>> 
>> Is a CSR required to this change?
>> 
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Tatsunori Uchino has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Change "isolated surrogate code unit" to "unpaired surrogate"

test/jdk/java/lang/String/Supplementary.java line 425:

> 423:             int result = str.codePointCount();
> 424:             int expected = Character.codePointCount(str, 0, 
> str.length());
> 425:             check(result != expected, "substring:codePointCount()", 
> result, expected);

Nit - the error message is incorrect here. There's no substring involved here, 
so I think the message should just be "String::codePointCount()".

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26461#discussion_r3818027856

Reply via email to