RFR: 8364007: Add no-argument codePointCount method to CharSequence and String [v14]
Tatsunori Uchino
duke at openjdk.org
Thu Jan 29 10:47:55 UTC 2026
> 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 <liach at openjdk.org>
- ... and 10 more: https://git.openjdk.org/jdk/compare/681e4ec8...198b3188
-------------
Changes: https://git.openjdk.org/jdk/pull/26461/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26461&range=13
Stats: 80 lines in 7 files changed: 67 ins; 0 del; 13 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 core-libs-dev
mailing list