On Tue, 23 Apr 2024 17:35:42 GMT, Jason Mehrens <[email protected]> wrote:

>> A good question. The buf/count fields are protected so the subclass has 
>> direct access to the bytes. So while it could Arrays.copy the bytes, it 
>> doesn't help with a buggy subclass that is changing bytes without 
>> synchronization.
>
> I was thinking more of a subclass that counted invocations to public methods 
> or metering which would cause subclass to double the counts when calling via 
> virtual thread.

So do we think it better not to invoke `toByteArray` here?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18901#discussion_r1576686390

Reply via email to