RFR: 8361209: (bf) Use CharSequence::getChars for StringCharBuffer bulk get methods [v3]

Brett Okken duke at openjdk.org
Wed Jul 16 15:47:40 UTC 2025


On Tue, 15 Jul 2025 21:35:01 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> For `CharBuffer`s created from a `CharSequence`, use `CharSequence.getChars` to perform bulk gets instead of successively copying single characters.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8361209: Override getArray instead of API methods; modify absolute bulk put to use getArray for StringCharBuffer

src/java.base/share/classes/java/nio/X-Buffer.java.template line 956:

> 954:         if (
> 955: #if[char]
> 956:             isAddressable() &&

is `isAddressable` only relevant for `StringCharBuffer`?
If so, this check becomes effectively dead code with `StringCharBuffer` overriding the method.
Perhaps an assert statement instead to avoid any future modification breaking the assumption?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/26251#discussion_r2210816275


More information about the nio-dev mailing list