RFR: 8300979: Lazily initialize (byte, char)arr in java.io.DataInputStream
Alan Bateman
alanb at openjdk.org
Thu Mar 23 12:45:09 UTC 2023
On Wed, 22 Mar 2023 10:17:36 GMT, Per Minborg <pminborg at openjdk.org> wrote:
> > Nice idea. Just wonder could we do the same for `BufferedInputStream`?
>
> I think it is doable but would require some more work as nullity is used as a "closed flag".
I would nervous about changing BIS. The buf field is a protected field so lazy creating the array would lead to sub-classes throwing NPE or assuming the stream is closed. The closed state, the subclass in Process, and changing when/where OOME might be thrown are other considerations.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/13121#issuecomment-1481127986
More information about the core-libs-dev
mailing list