On Thu, 25 Jul 2024 00:24:59 GMT, Brian Burkhalter <b...@openjdk.org> wrote:

> Add some verbiage stating that two buffered readers or input streams should 
> not be used to read from the same reader or input stream, respectively.

I went through the linked JBS issue to understand why we are adding this. The 
use case appears to be that the application uses a BufferedReader instance on 
top of the underlying Reader R1, then does some API calls on the 
BufferedReader, then uses a separate and new BufferedReader instance on top of 
the same underlying R1 Reader instance.
I think the proposal to add this text is OK, although I wonder if this should 
also be added or is applicable to `BufferedOutputStream` too. Also, do you 
think we could reword the proposed text a bit? It wasn't immediately clear to 
me what issue we were trying to address with that text. Would something like 
the following be clearer:
> More than one instance of a BufferedReader should not be used with the same 
> instance of the underlying Reader. Doing so can cause the BufferedReader 
> instances to return an incorrect result since each instance of the 
> BufferedReader maintains its own state.

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

PR Comment: https://git.openjdk.org/jdk/pull/20320#issuecomment-2251988591

Reply via email to