On Mon, 1 Dec 2025 10:28:39 GMT, Jaikiran Pai <[email protected]> wrote:
>> Jaikiran Pai has updated the pull request incrementally with two additional
>> commits since the last revision:
>>
>> - 8372787: ModuleReader should throw IOException consistently when using
>> --patch-module and ModuleReader is closed
>> - Revert "8372787: ModulePatcher throws unspecified IllegalStateException
>> upon being invoked after close()"
>>
>> This reverts commit 42cfa0aa40926b748c6d7bdf814d85ca1ccd8fed.
>
> 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.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28569#discussion_r2576544760