On Fri, 8 Dec 2023 17:23:59 GMT, Markus KARG <d...@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? Technically speaking, `OutputStream` is an `abstract class`, so this declaration of `boolean trusted()` is a package-protected method that will be visible and overridable only within JDK itself. However, I agree it looks suspicious. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16879#discussion_r1420846454