[lworld] RFR: 8368333: [lworld] Add preview mode to ImageReader and JRT file-system [v3]
David Beaumont
duke at openjdk.org
Fri Oct 24 14:24:57 UTC 2025
On Wed, 8 Oct 2025 19:44:20 GMT, David Beaumont <duke at openjdk.org> wrote:
>> src/java.base/share/classes/jdk/internal/jimage/ModuleReference.java line 86:
>>
>>> 84: return new ModuleReference(moduleName, FLAGS_HAS_CONTENT | previewFlag(isPreview));
>>> 85: }
>>> 86:
>>
>> Using "of" as the prefix for the method name instead of "for" would align better with many other APIs.
>
> Hmm, I've always used "ofXxx" only when the `Xxx` is part of the given input.
>
> In this case the term "resource" isn't referring to the input, but the type of thing the reference is used for (something with content). In that situation `ofResource(<none-of-the-parameters-reference-a-resource>)` feels weird to me.
>
> Maybe `forResourceIn(<module-name>, <flag>)` makes it clearer a resource is not being passed into the method.
> Thoughts?
I changed the methods to `forPackageIn(<modname>...)` and `forEmptyPackageIn(<modname>...)`.
`ModuleReference` sits right on the boudary of package/module stuff. It references a module, but stores flags related to the package it's associated with. As such naming here is a bit fiddly.
-------------
PR Review Comment: https://git.openjdk.org/valhalla/pull/1619#discussion_r2460332684
More information about the valhalla-dev
mailing list