On Fri, 14 Aug 2026 08:05:57 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:
> 
>   Reapply JavaDoc

src/java.base/share/classes/java/lang/String.java line 1939:

> 1937:      * @since 28
> 1938:      */
> 1939:     public int codePointCount() {

The simpler/updated proposal looks good. The other methods that operate on code 
points will use "unpaired surrogates" and I think we should do the same here 
rather than switching to "Isolated surrogate code units".

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

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

Reply via email to