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

altrisi duke at openjdk.org
Thu Mar 23 19:57:34 UTC 2023


On Wed, 22 Mar 2023 10:12:26 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> This PR proposed to lazily initialize the scratch arrays only if/when needed.
>
> Per Minborg has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
> 
>  - Merge branch 'dis-lazy' of https://github.com/minborg/jdk into dis-lazy
>  - Update src/java.base/share/classes/java/io/DataInputStream.java
>    
>    Co-authored-by: Eirik Bjorsnos <eirbjo at gmail.com>
>  - Merge branch 'master' into dis-lazy
>  - Remove redundant initilizers
>  - Lazily initialize (byte, char)arr in java.io.DataInputStream

If that's the case an alternative idea could be to make them hold a (shared) empty array by default instead, that'd also match the condition (except the 0 length case) for entering the branch and wouldn't be null.

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

PR Comment: https://git.openjdk.org/jdk/pull/13121#issuecomment-1481808015


More information about the core-libs-dev mailing list