On Fri, 17 Apr 2026 17:14:56 GMT, Alan Bateman <[email protected]> wrote:
>>> From: >>> https://docs.oracle.com/en/java/javase/26/docs/api/java.base/java/lang/module/ModuleReader.html#list() >>> >>> ``` >>> Lists the contents of the module, returning a stream of elements that are >>> the names of all resources in the module. [...] >>> ``` >>> >>> Note: **all** resources. The class bytes of a preview class is a resource. >> >> No, at the SystemImage level, preview resources don't exist and must not be >> visible. >> >> The set of "all resource names" does not (and cannot) include them because >> they are not "name of resources", they are non visible paths to storage >> locations which are not being presented via this API. > >> Note: all resources. The class bytes of a preview class is a resource. > > It's the names of all resources in the module. There aren't names starting > with "META-INF/preview". Note that it's similar to the view with > multi-release JARs where the stream doesn't return names starting with > "META-INF/versions" (see JarFile::versionedStream). > > I think the only difference to highlight is the URL where a URL to an entry > backed by a resource in a versioned section of a MR JAR needs to encode the > "real path". This was a forced move for MR JARs but should not be necessary > here as the jrt URL is the current runtime. > No, at the SystemImage level, preview resources don't exist and must not be > visible. > > The set of "all resource names" does not (and cannot) include them because > they are not "name of resources", they are non visible paths to storage > locations which are not being presented via this API. Shouldn't `ModuleReader.open("META-INF/preview/java/lang/Byte.class")` then also not return the input stream to the preview classes? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/29414#discussion_r3109337958
