[lworld] RFR: 8377162: [lworld] getResourceAsStream() doesn't work in preview mode for exploded images [v5]

David Beaumont duke at openjdk.org
Mon Feb 23 14:39:17 UTC 2026


On Fri, 20 Feb 2026 13:46:37 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> David Beaumont has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Review feedback
>
> test/jdk/jdk/internal/jrtfs/ClassResourcesParityTest.java line 74:
> 
>> 72:             String relPath = jrtClassFile.subpath(2, jrtClassFile.getNameCount()).toString();
>> 73:             String fqn = relPath.substring(0, relPath.length() - CLASS_SUFFIX.length()).replace('/', '.');
>> 74:             String baseName = fqn.substring(fqn.lastIndexOf('.') + 1);
> 
> This is fine, just FYI that JAVA_BASE.relativize(jrtClassFile) is another slicker way to get the relative path from /module/java.base to the resource.

Hmm, good point. However I don't have the /modules/<name> path to hand here, so I still need to subpath() something. So it's

jrtClassFile.subpath(0, 2).relativize(jrtClassFile).toString();

vs
            
jrtClassFile.subpath(2, jrtClassFile.getNameCount()).toString();

Marginal win for readability.

-------------

PR Review Comment: https://git.openjdk.org/valhalla/pull/2032#discussion_r2841198415


More information about the valhalla-dev mailing list