RFR: 8336470: Source launcher should work with service loader SPI in unnamed module [v7]

Alan Bateman alanb at openjdk.org
Fri May 9 09:28:52 UTC 2025


On Fri, 9 May 2025 08:39:17 GMT, Christian Stein <cstein at openjdk.org> wrote:

>> src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/MemoryClassLoader.java line 278:
>> 
>>> 276:      */
>>> 277:     private URL toResourceInRootPath(String name) {
>>> 278:         var file = programDescriptor.sourceRootPath().resolve(name);
>> 
>> "name" is an abstract resource name, so it's a '/' separated sequence of names. Is there is mapping step missing here?
>
> Hm, if it missing, it was missing before. I moved the line from the former location with a different variable name:
> `var programPath = programDescriptor.sourceRootPath().resolve(name);` into this new helper method. All tests and manual usages remain "green".
> 
> Which kind of mapping are you missing here? From `/` to `\` or `.`?

In java.base, look at jdk.internal.module.Resources.toFilePath to see how the built-in class loaders map resource names to relative file paths. I don't think you'll need as much here. My point is that a resource name can't be be used a file path. Also it's okay if you want to separate it to a separate issue, it's just something that jumps out when scanning this.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20193#discussion_r2081296721


More information about the compiler-dev mailing list