RFR: 8320971: Use BufferedInputStream.buf directly when param of implTransferTo() is trusted [v18]

Sergey Tsypanov stsypanov at openjdk.org
Sat Dec 30 16:47:11 UTC 2023


On Sat, 30 Dec 2023 12:05:22 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Sergey Tsypanov has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8320971: Fix test
>
> src/java.base/share/classes/java/io/BufferedInputStream.java line 672:
> 
>> 670:      * <li>does not modify the contents of the {@code byte[]}</li>
>> 671:      * <li>{@code OutputStream.write(byte[], int, int)} write does not read the contents outside of the offset/length bounds</li>
>> 672:      * </ul>
> 
> The implementation change looks fine, just a typo at L671 where it says "write write", I think you can shorten this to say that the write method doesn't read the contents outside of the offset/length bounds.

Done. Can we somehow modify the test to make it white-box one? Maybe it's possible to measure memory allocation before and after method invocation in the way that we could use the difference as a proof of non-allocating invocation for trusted OutputStreams?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16879#discussion_r1438651570


More information about the core-libs-dev mailing list