On Sat, 15 Oct 2022 14:38:04 GMT, Alan Bateman <al...@openjdk.org> wrote:
> > @AlanBateman WDYT? Is such a test mandatory to include this rather simple > > PR? > > I think it means checking that > test/jdk/java/io/BufferedInputStream/TransferTo.java exercises this code > path, I expect it should. > > It might seem a "rather simple PR" but it leaks a reference to the internal > buffer to the target and we need to get comfortable with that. It only does > then when there is no mark (good) so this should mostly limit the concern to > sources where EOF may be encountered more than once. Which kind of sources would do that, and is there a way to check it and prevent it? The whole issue points to an insufficiency in the API: it is lacking a way to transfer buffers in a read-only fashion (like NIO could do). I don't suppose we would want to change that, though, right? ------------- PR: https://git.openjdk.org/jdk/pull/10525