RFR: 8372787: ModuleReader should throw IOException consistently when using --patch-module and ModuleReader is closed [v6]

Alan Bateman alanb at openjdk.org
Mon Dec 1 18:20:51 UTC 2025


On Mon, 1 Dec 2025 16:44:06 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

>> Can I please get a review of this change which proposes to address the issue noted in https://bugs.openjdk.org/browse/JDK-8372787?
>> 
>> The commit in this PR updates several methods in the `jdk.internal.module.ModulePatcher$PatchedModuleReader` to throw an `IOException` if the `ModuleReader` has been closed. This updated implementation now matches the specification of the corresponding methods in `ModuleReader`.
>> 
>> A new jtreg test has been introduced to reproduce the issue and verify the fix. CI testing is currently in progress with this change.
>
> Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Alan's suggestion - additional tests to the found resource URI

src/java.base/share/classes/jdk/internal/module/ModulePatcher.java line 424:

> 422:         @Override
> 423:         public void close() throws IOException {
> 424:             closed = true;

It might be a bit better to avoid the closeAll+delegate if already closed.

test/jdk/java/lang/module/ModuleReader/patched/PatchedModuleReaderTest.java line 40:

> 38: /*
> 39:  * @test
> 40:  * @bug 8372787

Can you fix the `@summary` so that it starts with "Test the .." or "Verify the ..."

test/jdk/java/lang/module/ModuleReader/patched/PatchedModuleReaderTest.java line 110:

> 108: 
> 109:         // verify IOException is thrown by the closed ModuleReader
> 110:         resources.forEach(rn -> {

The test should also check reader.list() throws IOException.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28569#discussion_r2578160184
PR Review Comment: https://git.openjdk.org/jdk/pull/28569#discussion_r2578158174
PR Review Comment: https://git.openjdk.org/jdk/pull/28569#discussion_r2578154762


More information about the core-libs-dev mailing list