RFR: 8336470: Source launcher should work with service loader SPI in unnamed module [v7]
Alan Bateman
alanb at openjdk.org
Fri May 9 08:26:56 UTC 2025
On Tue, 29 Apr 2025 10:15:19 GMT, Christian Stein <cstein at openjdk.org> wrote:
>> Please review this change adding a missing resource file test to the `MemoryClassLoader::findResource` override in order to resolve all files beneath the source root path in source launch mode - analog to what was already implemented for `MemoryClassLoader::getResource`.
>>
>> With this change applied, files in `META-INF/services/` are resolved; allowing services providers being supplied in source form.
>
> Christian Stein has updated the pull request incrementally with two additional commits since the last revision:
>
> - Update copyright year
>
> [skip ci]
> - User copyright text w/o `"Classpath" exception`
>
> [skip ci]
src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/MemoryClassLoader.java line 232:
> 230: String binaryName = toBinaryName(name);
> 231: if (binaryName == null || sourceFileClasses.get(binaryName) == null) {
> 232: return toResourceInRootPath(name); // can be null
"can be null" is a bit confusing here. I initially read it that name can be null but this isn't possible, at least not with a well behaved class loader as the getResource methods are specified to reject null so will never delegate a null to findResource. The comment is really that it might return null (meaning not found).
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20193#discussion_r2081182875
More information about the compiler-dev
mailing list