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

Bernd duke at openjdk.org
Fri Dec 1 14:08:06 UTC 2023


On Thu, 30 Nov 2023 09:36:01 GMT, Bernd <duke at openjdk.org> wrote:

>> Sergey Tsypanov has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8320971: Trust any OutputStream from java.*
>
> Did you review if all Java.* streams are safe?
> 
> There are a few stream adapters in sun.nio.ch, which would benefit this optimization too, unfortunately they wrap the arrays with ByteBuffer.wrap, I guess that’s not safe, so the package can’t be allowed?

> @ecki I've checked the streams in `java.*` and it looks like none of them modifies the incoming `byte[]`

i think modification is not the problem, the querstion is if they get exposed to user code. (but yes the readonly ByteBuffer wrapper looks like a good thing to use more).

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

PR Comment: https://git.openjdk.org/jdk/pull/16879#issuecomment-1836173674


More information about the core-libs-dev mailing list