RFR: 8320971: Use BufferedInputStream.buf directly when param of implTransferTo() is trusted [v5]
Sergey Tsypanov
stsypanov at openjdk.org
Fri Dec 8 20:19:16 UTC 2023
On Fri, 8 Dec 2023 17:23:59 GMT, Markus KARG <duke at openjdk.org> wrote:
>> Sergey Tsypanov has updated the pull request incrementally with one additional commit since the last revision:
>>
>> 8320971: Use same approach as BAOS
>
> src/java.base/share/classes/java/io/OutputStream.java line 212:
>
>> 210: * @return true if the argument of {@link #write(byte[])}} and {@link #write(byte[], int, int)}} needn't be copied
>> 211: */
>> 212: boolean trusted() {
>
> This is a strange construction. Any subclass could simply implement this as `return true;`. Where is the guard against this, and why not doing it that way?
@mkarg I guess the method can only be implemented by subclasses residing in the same package with `OutputStream`, right?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16879#discussion_r1420990889
More information about the core-libs-dev
mailing list