On 18/12/2024 15:09, David Lloyd wrote:
:
No. Since we are late-binding all modules, every module we would load
would start with no `requires`, and we use `addReads` on the
controller to wire in the dependencies when the module is lazily linked.
I'm going to stop here as I think there is enough in this sentence to
put context on where you are coming from and why some of the previous
mails were a bit baffling.
If I've compiled my code as a module then it will have declared its
dependencs, it may use or provide services, and it might export some
internal packages to other modules in the project. I think your mail is
suggesting that the module-info.class is modified, or substituted, in
your system to not have any references to other modules. Once the module
is reified by creating a single-module module-layer then read edges will
be added dynamically. I assume that anything that uses APIs to examine
the Module or ModuleDescriptor will see a module that only requires
java.base.
My view is that this direction is in a completely different design space
to that of configurations and module layers. We did build an internal
API to support very specific "dynamic module" use-cases in the JDK, e.g.
some Proxy scenarios required do code gen into a dynamic code, same
thing with code generation for RMI remove refs. We decided to not expose
anything at this level as it's essentially the all powerful Unsafe API
for modules.
So within the current design, I don't think adding addUses/addProvides
methods to ML.Controller make sense.
-Alan