RFR: 8300236: Use VarHandle access in Data(Input | Output)Stream classes [v5]

Alan Bateman alanb at openjdk.org
Tue Jan 24 10:33:09 UTC 2023


On Mon, 23 Jan 2023 12:38:24 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> This PR proposes using a performance optimization using a new supported API for operations similar to those found in `java.io.Bits`
>
> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Remove methods with implicit zero offset

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

> 57:     }
> 58: 
> 59:     private final byte[] readBuffer = new byte[8];

No objection to the readBuffer but it does make it wonder if we should re-visit bytearr and chararr as they are only need for reading modified UTF-8 strings and shouldn't need to be eagerly created.

src/java.base/share/classes/jdk/internal/util/ByteArray.java line 37:

> 35:  * <p>
> 36:  * All methods in this class will throw an {@linkplain NullPointerException} if {@code null} is
> 37:  * passed in as a method parameter for a byte array.

The NPE is described in both the class description and some of the methods, it doesn't need to be both.

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

PR: https://git.openjdk.org/jdk/pull/12076


More information about the core-libs-dev mailing list