RFR: 8320971: Use BufferedInputStream.buf directly when param of implTransferTo() is trusted [v18]
Markus KARG
duke at openjdk.org
Thu Dec 28 15:09:10 UTC 2023
On Sat, 23 Dec 2023 19:11:35 GMT, Sergey Tsypanov <stsypanov at openjdk.org> wrote:
>> test/jdk/java/io/BufferedInputStream/TransferToTrusted.java line 83:
>>
>>> 81: var internalBuffer = bis.getClass().getDeclaredField("buf");
>>> 82: internalBuffer.setAccessible(true);
>>> 83: if (!Arrays.equals(buf, Arrays.copyOf((byte[]) internalBuffer.get(bis), length))) {
>>
>> This is not testing the absence of a copy.
>
> Yeah, but how could I intercept the argument of OutputStream.write() and check it's identity?
As I wrote earlier today to Vladimir (see above) I actually do not see a solution for this, frankly spoken, as the interceptor would not be trusted. That's why I asked Brian for his ok to keep the test as-is. We need to wait for his judgement, as he is the reviewer, not me (I only try to give initial advice). My comment was more a hint for me to wait for Brian's judgement, less a request to you to fix this.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16879#discussion_r1435734672
More information about the core-libs-dev
mailing list