On Tue, 27 Jan 2026 11:33:21 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?
>
> Tatsunori Uchino has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Replace "unpaired surrogates" with "isolated surrogate code units"
>   
>   https://www.unicode.org/versions/Unicode17.0.0/core-spec/chapter-3/#G1654
>   https://www.unicode.org/charts/PDF/UDC00.pdf

/home/runner/work/jdk/jdk/test/jdk/java/lang/Character/Supplementary.java:352: 
error: incompatible types: String cannot be converted to char[]
        int n = Character.codePointCount(str);


Seeing this error message, users will think that Java is clunky and unhelpful.

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

PR Comment: https://git.openjdk.org/jdk/pull/26461#issuecomment-3810291676

Reply via email to