RFR: 8360037: Refactor ImageReader in preparation for Valhalla support [v2]
David Beaumont
duke at openjdk.org
Tue Jul 1 20:37:06 UTC 2025
On Tue, 1 Jul 2025 19:54:10 GMT, David Beaumont <duke at openjdk.org> wrote:
>> src/java.base/share/classes/jdk/internal/module/SystemModuleFinders.java line 456:
>>
>>> 454: Optional<ImageReader.Node> node = Optional.ofNullable(reader.findNode(nodeName));
>>> 455: if (node.isPresent() && !node.get().isResource()) {
>>> 456: throw new IllegalStateException("Not a resource node: " + node.get());
>>
>> The IllegalStateException is problematic here, maybe you mean to add an assert?
>
> This is called externally so cannot trust the given name really references a resource.
> I can't therefore make it an assertion, but I can just return empty if it didn't point at a resource (even if it did point at a directory etc.). Or I can make it an Error.
I made it return empty for now and documented it as such.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26054#discussion_r2178467594
More information about the core-libs-dev
mailing list