On 28/11/2021 22:29, Michał Kłeczek wrote:
:
It looks like ML.Controller.addExport(source, pn, target) does not update the 
target module ClassLoader view of exported packages in the default ClassLoader 
implementation (jdk.internal.loader.Loader).
What is the reasoning behind such implementation? I am wondering now how useful 
Controller.addExport() really is...

The addXXX methods are about accessibility. In the case of addExports then maybe you want to export an internal package so that code in a module in the child layer can make use of (via reflection) public classes in that package.

You are right that the addXXX methods doesn't do any magic for visibility. For super advanced cases where someone is using their own class loaders then they need to ensure that the class loader delegation supports the readability graph. Same thing when they use addExports where they may need to their class loaders to adjust their delegation to support changes at run-time.

-Alan

Reply via email to