On Tue, 21 Apr 2026 11:23:12 GMT, Alan Bateman <[email protected]> wrote:
> There is a lot of complexity in this, which is partly why it has taken me a
> long time to go through all these changes. This is why I'm wondering about
> making this simpler so that there are only 2 views.
I for one, would welcome only two views. For my taste there are some strange
inconsistencies (I'm using valhalla EA JDK for this):
$ ./bin/jshell
| Welcome to JShell -- Version 27-jep401ea3
| For an introduction type: /help intro
jshell> var mref = ModuleFinder.ofSystem().find("java.base").orElseThrow();
mref ==> [module java.base, location=jrt:/java.base]
jshell> var bytePreviewResource = "META-INF/preview/java/lang/Byte.class";
bytePreviewResource ==> "META-INF/preview/java/lang/Byte.class"
jshell> var bytePreview = mref.open().list().filter(n ->
n.equals(bytePreviewResource)).toList();
bytePreview ==> []
jshell> var inStream = mref.open().find(bytePreviewResource).orElseThrow();
inStream ==> jrt:/java.base/META-INF/preview/java/lang/Byte.class
i.e. the `bytePreview` variable would not be empty when an InputStream for the
same resource can be found (using `ModuleReader.find()`).
Also the `open()` call returns the resource's inputstream:
bin/jshell
| Welcome to JShell -- Version 27-jep401ea3
| For an introduction type: /help intro
jshell> var bytePreviewResource = "META-INF/preview/java/lang/Byte.class";
bytePreviewResource ==> "META-INF/preview/java/lang/Byte.class"
jshell> var inStream =
java.lang.Object.class.getResourceAsStream(bytePreviewResource);
inStream ==> null
jshell> var inStream = java.lang.Object.class.getResourceAsStream("/" +
bytePreviewResource);
inStream ==> java.io.ByteArrayInputStream@67205a84
jshell> var mref = ModuleFinder.ofSystem().find("java.base").orElseThrow();
mref ==> [module java.base, location=jrt:/java.base]
jshell> var inStream = mref.open().open(bytePreviewResource).orElseThrow();
inStream ==> java.io.ByteArrayInputStream@5e853265
jshell>
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29414#discussion_r3117726949