RFR: 8364007: Add no-argument codePointCount method to CharSequence and String [v19]
Alan Bateman
alanb at openjdk.org
Sat Jan 31 15:59:07 UTC 2026
On Sat, 31 Jan 2026 14:31:39 GMT, Tatsunori Uchino <duke at openjdk.org> 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:
>
> Add missing semicolon
src/java.base/share/classes/java/nio/X-Buffer.java.template line 2061:
> 2059:
> 2060: /**
> 2061: * {@return the number of Unicode code points in this character sequence
Can you change the first sentence to : "{@return the number of Unicode code points in this character buffer}".
The rest can go into a second paragraph that starts with "The number of Unicode code points in this character buffer is the number of Unicode code points between the position (inclusive) and the limit (exclusive).".
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26461#discussion_r2749697267
More information about the core-libs-dev
mailing list