RFR: 8372353: API to compute the byte length of a String encoded in a given Charset [v17]
Liam Miller-Cushon
cushon at openjdk.org
Wed Feb 25 17:34:11 UTC 2026
On Wed, 25 Feb 2026 17:25:33 GMT, Eirik Bjørsnøs <eirbjo at openjdk.org> wrote:
>> I agree that `encodedLength(cs)` is a cleaner name and consistent with more of the String API.
>> The `get` was a carry over from the original method.
>
> Reemerging from my armchair to express a small preference for `encodedLength(Charset)`.
>
> A `get` prefix does not evoke computation to me, usually the contrary in that it may be a simple getter.
>
> Also, local consistency in String in perhaps more important than global consistency in the JDK for this operation. String does not seem to lean much toward `get` prefixes.
Thank you! I have updated the PR and CSR to `encodedLength`, I will plan on finalizing the CSR soon.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28454#discussion_r2854390190
More information about the core-libs-dev
mailing list