RFR: 8341566: Adding factory for non-synchronized CharSequence Reader [v2]
Chen Liang
liach at openjdk.org
Sun Oct 6 16:44:34 UTC 2024
On Sun, 6 Oct 2024 14:58:23 GMT, Markus KARG <duke at openjdk.org> wrote:
>> src/java.base/share/classes/java/io/Reader.java line 161:
>>
>>> 159: * {@code read(char[])}, {@code read(char[], int, int)},
>>> 160: * {@code read(CharBuffer)}, {@code ready()}, {@code skip(long)}, and
>>> 161: * {@code transferTo()} methods all throw {@code IOException}.
>>
>> I believe these 2 paragraphs are all redundant besides the initial `The returned stream is initially open.` sentence: those are duplicating information already available from `Reader::close` specification.
>>
>> Closing `StringReader` is optional but its specification doesn't mention this. I think we don't need to mention if closing is optional, so that one sentence is sufficient.
>
> This text already exists in this very file, it is a 1:1 copy from `nullReader()`. It cannot be wrong for `of()` if it was correct for `nullReader()`. To stay consistent with existing JavaDocs in this very same file, we should not have different texts for the same cases.
`nullReader` needs this because it specifies the open behavior of these methods. This API does not have to; we can check out how others think in the CSR review.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21371#discussion_r1789158447
More information about the core-libs-dev
mailing list