RFR: 8255878: FilterInputStream is missing implementations of Java 9 InputStream methods [v2]

Daniel Fuchs dfuchs at openjdk.java.net
Tue Sep 7 08:47:46 UTC 2021


On Mon, 6 Sep 2021 12:02:12 GMT, Alan Bateman <alanb at 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


More information about the core-libs-dev mailing list