RFR: 8306914: Implementation of JEP Launch Multi-File Source-Code Programs [v4]
Christian Stein
cstein at openjdk.org
Fri Oct 27 11:04:36 UTC 2023
On Wed, 25 Oct 2023 13:43:31 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> Christian Stein has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Main method determines the main class now
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/MemoryContext.java line 238:
>
>> 236: var memoryConfig = parentLayer.configuration().resolveAndBind(memoryFinder, ModuleFinder.of(), Set.of(applicationModule.name()));
>> 237: var memoryClassLoader = new MemoryClassLoader(inMemoryClasses, parentLoader, applicationModule, descriptor, this::compileJavaFileByName);
>> 238: var memoryController = ModuleLayer.defineModules(memoryConfig, List.of(parentLayer), __ -> memoryClassLoader);
>
> It would be helpful if the comment were expanded to explain why memoryClassLoader is needed here. ClassLoaders created by the defineModulesXXX methods are capable to loading modules in memory file systems, the issue is the dynamic compilation (I think).
I'll add a comment explaining that the `MemoryClassLoader` is required here to compile referenced types from their source files on-the-fly.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13712#discussion_r1374409785
More information about the compiler-dev
mailing list