RFR: 8364007: Add overload without arguments to codePointCount in String etc. [v3]
Tatsunori Uchino
duke at openjdk.org
Sat Jul 26 10:10:40 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:
- Update `@bug` in correct file
- Add default implementation on codePointCount in CharSequence
- Update `@bug` entries in test class doc comments
- Discard changes on code whose form is not `str.codePointCount(0, str.length())`
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/26461/files
- new: https://git.openjdk.org/jdk/pull/26461/files/63eb4a7d..0e55e35c
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=26461&range=02
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=26461&range=01-02
Stats: 32 lines in 5 files changed: 26 ins; 0 del; 6 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