RFR: 8300979: Lazily initialize (byte, char)arr in java.io.DataInputStream

Eirik Bjorsnos duke at openjdk.org
Tue Mar 21 16:11:43 UTC 2023


On Tue, 21 Mar 2023 15:41:13 GMT, Per Minborg <pminborg at openjdk.org> wrote:

> This PR proposed to lazily initialize the scratch arrays only if/when needed.

Looks good. Many DataInputStreams probably never read UTF. (Not a reviewer)

src/java.base/share/classes/java/io/DataInputStream.java line 576:

> 574:         char[] chararr = null;
> 575:         if (in instanceof DataInputStream dis) {
> 576:             if (dis.bytearr == null || dis.bytearr.length < utflen){

Add a space between ')' and '{'?

Suggestion:

            if (dis.bytearr == null || dis.bytearr.length < utflen) {

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

Marked as reviewed by eirbjo at github.com (no known OpenJDK username).

PR Review: https://git.openjdk.org/jdk/pull/13121#pullrequestreview-1350859010
PR Review Comment: https://git.openjdk.org/jdk/pull/13121#discussion_r1143638420


More information about the core-libs-dev mailing list