<i18n dev> RFR: 8364007: Add overload without arguments to codePointCount in String etc. [v2]

Tatsunori Uchino duke at openjdk.org
Sat Jul 26 08:36:41 UTC 2025


> 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 four additional commits since the last revision:

 - Discard changes out of than java.base
 - Fix copyright year
   
   Co-authored-by: Mikhail Yankelevich <myankelevich at openjdk.org>
 - Fix how to get code point count in StringBuilder
   
   Co-authored-By: Chen Liang <liach at openjdk.org>
 - Fix test

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/26461/files
  - new: https://git.openjdk.org/jdk/pull/26461/files/6f2e1d2b..63eb4a7d

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=26461&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=26461&range=00-01

  Stats: 10 lines in 7 files changed: 0 ins; 0 del; 10 mod
  Patch: https://git.openjdk.org/jdk/pull/26461.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/26461/head:pull/26461

PR: https://git.openjdk.org/jdk/pull/26461


More information about the i18n-dev mailing list