On Wed, 14 May 2025 20:58:47 GMT, Roger Riggs <rri...@openjdk.org> wrote:

>> BTW, paraphrasing Stuart here: "We want to reduce self-calls". `subSequence` 
>> is a self-call, *as we do not know* how it behaves in the actual 
>> implementation. For `getChars` we can be sure that it has no overridable 
>> side effects.
>
> Both `subSequence` and `getChars` are implemented by the CharSequence.
> They have the same level of trustworthiness about their implementation.

I meant that the implementation of `subSequence` *might or might not* perform 
copy (so we need to tell the javaDoc reader), while `getChar` *clearly* 
performs a copy as part of it design. So `subSequence` can be surprising as 
this discussion proofs, while `getChars` will not. That was Stuart's point with 
`read`, and that was your point with `CharSequence`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24728#discussion_r2089749078

Reply via email to