RFR: 8364007: Add overload without arguments to codePointCount in String etc.
Roger Riggs
rriggs at openjdk.org
Thu Jul 24 15:15:01 UTC 2025
On Thu, 24 Jul 2025 14:50:07 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?
The recommended process for proposing new APIs is to put the proposal to the OpenJDK core-libs-dev mail alias.
Putting the effort into a PR before there is some agreement on the value is premature.
And yes, every change to the spec needs a CSR.
To keep the proposal focused on the APIs, please drop the changes to modules other than java.base.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/26461#issuecomment-3113849427
PR Comment: https://git.openjdk.org/jdk/pull/26461#issuecomment-3113856629
More information about the core-libs-dev
mailing list