On Thu, 29 Jan 2026 10:47:55 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 with a new target base due to a 
> merge or a rebase. The pull request now contains 20 commits:
> 
>  - Merge remote-tracking branch 'origin/master' into codepoint-count
>  - Fix comments
>  - Don't use removed `Character::codePointCount` overload
>  - Update year in copyright
>  - Fix double empty lines
>  - Remove `Character.codePointCount()`
>  - 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
>  - Remove `Character.codePointCount` overload
>  - Rename parameter names from `a` to `seq`
>    
>    `chars` is too confusing with `char`
>  - Improve JavaDoc
>    
>    Co-authored-by: Chen Liang <[email protected]>
>  - ... and 10 more: https://git.openjdk.org/jdk/compare/681e4ec8...198b3188

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

> 1884:      * {@return the number of Unicode code points in this String}
> 1885:      * Isolated surrogate code units count as one code point each.
> 1886:      *

I think this can be deleted as well.

test/jdk/java/lang/StringBuilder/Supplementary.java line 218:

> 216: 
> 217:     /**
> 218:      * Test codePointCount(int, int) & codePointCount()

I think a separate test method needs to be added solely for `codePointCount()` 
to follow the pattern in this test file. Bonus if you could rename each `testX` 
to `testMethodName`
(This test seems to have a lot of room for refactoring, but they are for 
another time)

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

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

Reply via email to