On 04/11/2016 13:22, Jochen Theodorou wrote:

:

well... assume you have an application and it requires the library A, which transitively requires B-1. the application also requires library C, which transitively requires B-2. B-1 and B-2 are not compatible. library A and D leak instances of classes of B-1 and B-2 to the application.

Assuming B-1 and B-2 export the same packages, A `requires transitive B-1` (because a method in A's API returns a B type), C `requires transitive B-2` (because a method in C's API returns a B type) then you will get an exception when attempting to create the configuration. The exception will tell you that the application module reads two modules (B-2 and B-2) that export the same package to the application. Attempting to do this with multiple configuration + layers isn't going to help, it's just not safe, and you'll get the same exception.

You can of course go off-piste and use the reflective API to have the application read both B-1 and B-2, and if it its your own class loaders then you can go crazy with split delegation, but that is not something that you get out of the box.

-Alan

Reply via email to