RFR: 8354724: Methods in java.io.Reader to read all characters and all lines [v22]
Markus KARG
duke at openjdk.org
Thu May 15 05:55:54 UTC 2025
On Wed, 14 May 2025 22:19:39 GMT, Stuart Marks <smarks at openjdk.org> wrote:
>> 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`.
>
> @mkarg Please don't invoke my name to try to buttress your arguments. The calls the Reader.of() instance makes on its backing CharSequence is a different kind of issue from what promises or guarantees the concrete methods of the Reader class makes to its subclasses.
@stuart-marks Sorry, didn't want to pull you in here, that's why I said, I am just *paraphrasing*.
That is correct, it is a different case, but the *final effect* for the caller is the same: If he needs to now whether a copy is made *or not*, he needs to have JavaDocs telling him *how* the new method works inside (whether it calls `subSequence` or whether it calls `getChars`). Otherwise he might make false assumptions about the result.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24728#discussion_r2090314165
More information about the core-libs-dev
mailing list