On Sun, 21 Aug 2022 07:21:08 GMT, Alan Bateman <al...@openjdk.org> wrote:

> 'in' is a protected field so it requires thinking about subclasses that might 
> change 'in', say when the input stream is asynchronously closed. 
> BufferedInputStream is an example of a FilterInputStream that sets 'in' to 
> null when asynchronously closed. There are other examples that change the 
> underlying input stream to one that returns EOF when closed. So it might be 
> that changing readChar/readInt/readLong is okay but it would have a bigger 
> effect on readFully, skip and the other methods. So I think this is a case of 
> proceeding with caution as there may be more gong on.

On the other hand I don't see anything checking for `in == null`, so if `in` 
was null a `NullPointerException` exception would occur, which I doubt is the 
behavior that the subclass is expecting. I agree that caution is warranted, but 
if `in` is actually set to `null` by subclasses we should probably double check 
how/when they rely in their super class behavior: some bugs might be lurking.

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

PR: https://git.openjdk.org/jdk/pull/9956

Reply via email to