On 10/05/2017 15:32, Peter Levart wrote:

Hi,

Two modules can have packages with same name if they are not exported *and* each of the modules loads classes using distinct class loaders, right?
That's right. If the modules are defined to different class loaders then they can even export the same API packages as long as one doesn't read the other.


This is a limitation imposed primarily because of ability to load multiple modules using same class loader. But if the modules that have types loaded by the same class loader contain concealed (non-exported) packages of the same name and those packages contain only resources, then in theory, JPMS could allow such configuration, because for loading private resources, there's no need to consult the ClassLoader. Each module could load its private resources with the sole help of its ModuleReader. Am I right?
If the resources don't need to be encapsulated then the module doesn't need to contain the "package". The packages in an automatic module only contain the packages containing classes so this is why it works with automatic modules.

The class loaders that locate resources in modules do so with a ModuleReader.

-Alan

Reply via email to