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"
A general note about the test coverage for this new method. I was going to
suggest adding a test for `String.codePointCount()` on an empty `String`, but
looking at the `Supplementary.java` test that is being updated in this PR, I
don't think that's the right place for this. I also looked at existing test
classes in `test/jdk/java/lang/String` directory but I can't find any existing
test which could host new tests for `codePointCount()`.
Stuart @stuart-marks do you think we should create an additional test class
under `test/jdk/java/lang/String` to add more coverage for this new method? Of
course, the current proposed changes in `Supplementary.java` test would
continue to stay.
@tats-u let's wait to hear from Stuart before adding the coverage for empty
String.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/26461#issuecomment-5350289523