RFR: 8341566: Adding factory for non-synchronized CharSequence Reader [v6]

Markus KARG duke at openjdk.org
Wed Oct 9 07:03:02 UTC 2024


On Wed, 9 Oct 2024 06:43:14 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

>> Markus KARG has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Improved wording: 'If the sequence changes while the reader is open, e.g. the length changes, the behavior is undefined.'
>
> src/java.base/share/classes/java/io/Reader.java line 182:
> 
>> 180:             private void ensureOpen() throws IOException {
>> 181:                 if (isClosed)
>> 182:                     throw new IOException("Stream closed");
> 
> Should the exception text instead be "Reader closed" and also the code comment a couple of lines above, replace "stream" to "reader"?

The complete implementation was copied from "StringReader" (see https://github.com/openjdk/jdk/blob/d809bc0e21b145758f21c4324772faf6aa6a276a/src/java.base/share/classes/java/io/StringReader.java#L57), so it was "Stream closed" there already, and "StringReader" now refers to this new code location. I deliberately did not modify anything else but the essentially needed parts. If we change this text here, this might be unexpected by existing applications.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21371#discussion_r1792973262


More information about the core-libs-dev mailing list