On Fri, 6 Oct 2023 06:09:50 GMT, Alan Bateman <al...@openjdk.org> wrote:

>> When a named module is created, we know its location, which is also passed 
>> to the C code and stored inside the C++ `ModuleEntry` data structure.
>> 
>> https://github.com/openjdk/jdk/blob/a1c9587c27538bda3b0f6745d9c80ff4e1b9a77e/src/java.base/share/classes/java/lang/Module.java#L128-L150
>> 
>> Maybe we can add a new native method 
>> `jdk.internal.misc.CDS.isBuiltinModule(Module m)` which tests if 
>> `ModuleEntry::_location` starts with `"jrt:"`?
>
>> Maybe we can add a new native method 
>> `jdk.internal.misc.CDS.isBuiltinModule(Module m)` which tests if 
>> `ModuleEntry::_location` starts with `"jrt:"`?
> 
> There isn't any really notion of "built-in module", they may be modules in 
> the run-time image that start with names such than "java." or "jdk.".  Are 
> you just looking to know if the module is in the run-time image and hasn't 
> been upgraded?

I've found a way to determine if a module is from the runtime image by checking 
the module's `location` and the `scheme` of the `location` is "jrt". All done 
at the java level. Please refer to my latest push with update on the 
ModuleBootstrap.java.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16016#discussion_r1362892360

Reply via email to