I assume this arrangement will fail with ClassCastException as B can't cast a 
A-Foo to a B-Foo.

If Core wants to provides a system-wide registry (which I think is what you are 
doing here) then it will need to be a Foo interface that is visible and 
accessible to all all users of that registry.

I understand you. However, this solution is not suitable for applications with 
plugins. As I've said, core application doesn't know what plugins do.
Suppose - every plugin is developed by a separate company, so, it is not 
possible to provide their shared APIs in common parent layer that is a
core application. Besides, all plugins are added to application the same way - 
one JPMS layer for one plugin with one parent that is a core
application. As you understand it is absolutely impossible to create for every 
plugin a unique layer structure.

Best regards, Pavel

Reply via email to