On Mon, 6 Sep 2021 12:02:12 GMT, Alan Bateman <al...@openjdk.org> wrote:

> Ah yes, I think you are right. In that case JDK-8255878 can be closed as WNF 
> or else FilterInputStream provides implementations of these methods that 
> don't directly delegate.

We could set a boolean in the constructor if `this.getClass() == 
FilterInputStream.class` and only delegate in that case. On the other hand - 
FilterInputStream seems to be intended for subclassing, so maybe that 
optimization should be done in its subclasses instead, when possible. That said 
- I see that the class level documentation of FilterInputStream says:

> The class FilterInputStream itself simply overrides all methods of 
> InputStream with versions that pass all requests to the contained input 
> stream.

which is no longer strictly true - should this sentence be amended to reflect 
what really happens?

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

PR: https://git.openjdk.java.net/jdk/pull/5367

Reply via email to