On Mon, 1 Dec 2025 10:38:39 GMT, Alan Bateman <[email protected]> wrote:

>> src/java.base/share/classes/jdk/internal/module/ModulePatcher.java line 314:
>> 
>>> 312:          */
>>> 313:         public Resource findResource(String name) throws IOException {
>>> 314:             ensureOpen();
>> 
>> Unlike the other methods which have been updated to call the `ensureOpen()`, 
>> this `findResource(...)` method isn't part of the `ModuleReader` interface. 
>> This only gets called from the `BuiltinClassLoader` when defining a `Class`. 
>> I looked up that code in `BuiltinClassLoader` and it already has a catch 
>> clause to handle `IOException`, so it felt right to add the `ensureOpen()` 
>> check here too.
>
> It would be a serious bug if we could somehow close the ModuleReader under 
> the feet of the built-in class loaders. We could potentially use an assert 
> here.

I have updated the PR to use an assert here instead of ensureOpen()

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28569#discussion_r2576588373

Reply via email to