On Mon, 23 Jun 2025 20:39:34 GMT, Coleen Phillimore <cole...@openjdk.org> wrote:
>> I didn't thought about this, but I think that's ok. I just propose to closed >> stream, not changing the exception handling. The >> >> try(InputStream is = loader.getResourceAsStream(name + ".class");) { >> InputStream is = loader.getResourceAsStream(name + ".class"); >> byte[] buf = is.readAllBytes(); >> System.out.println("sizeof(" + name + ".class) == " + buf.length); >> return buf; >> } >> >> has completely the same workflow, just closing stream so we don't have any >> resource leak. > > Oh so this try is a try-with-resources and it'll close the stream? It > compiles without a catch clause. yes, only change is that stream is closed. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25857#discussion_r2162502439