RFR: 8364007: Add overload without arguments to codePointCount in String etc.
Mikhail Yankelevich
myankelevich at openjdk.org
Thu Jul 24 21:53:54 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?
Could you please add a bug number under `@bug`?
test/jdk/java/lang/StringBuilder/Supplementary.java line 216:
> 214: testAppendCodePoint(Character.MAX_CODE_POINT+1, IllegalArgumentException.class);
> 215: }
> 216:
nit, as the other copyrights are updated:
* Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
-------------
PR Review: https://git.openjdk.org/jdk/pull/26461#pullrequestreview-3053452383
PR Review Comment: https://git.openjdk.org/jdk/pull/26461#discussion_r2229652045
More information about the core-libs-dev
mailing list