RFR: 8359707: Add classfile modification code to RedefineClassHelper [v2]

Leonid Mesnik lmesnik at openjdk.org
Mon Jun 23 20:47:28 UTC 2025


On Mon, 23 Jun 2025 20:39:34 GMT, Coleen Phillimore <coleenp at 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


More information about the serviceability-dev mailing list