RFR: 8372787: ModuleReader should throw IOException consistently when using --patch-module and ModuleReader is closed [v2]
Jaikiran Pai
jpai at openjdk.org
Mon Dec 1 11:08:12 UTC 2025
On Mon, 1 Dec 2025 10:40:17 GMT, Alan Bateman <alanb at openjdk.org> 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 228:
>
>> 226: private final URL delegateCodeSourceURL;
>> 227: private volatile ModuleReader delegate;
>> 228: private volatile boolean closed;
>
> A ModuleReader is specified to not require to support async close, so need to think about whether the closed flag should be volatile or not.
My original motivation to use `volatile` for `closed` was to match what we have for `delegate`. But the volatile on that, I believe, is for a different reason (for example: to avoid multiple `delegate` creations when different entry points into the `ModuleReader` are used concurrently).
In the latest update of the PR I have retained the `volatile` on `closed`, but I'm leaning towards removing that. But I'll wait for your input.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28569#discussion_r2576618790
More information about the core-libs-dev
mailing list