Are multiple versions of the same package in the module graph allowed?
mark.reinhold at oracle.com
mark.reinhold at oracle.com
Mon Oct 5 18:57:23 UTC 2015
2015/9/28 10:00 -0700, peter.kriens at aqute.biz:
> It is clear that it is illegal for a module to be exposed to 2 or more
> modules that export the same package. I assume that such an
> application will not start and throw an exception?
Correct.
> That said, there are many graphs were two or more packages are present
> in the graph, their modules are just never read by any module
> simultaneously. From reading the proposal I could not deduct if this
> is flagged as wrong or if this is actually allowed?
It may be allowed, or it may not, depending upon how the modules are
mapped to class loaders. Within a class loader, any particular package
is associated with precisely one module. If the two modules containing
the common package are mapped to the same loader then layer creation will
fail and an exception will be thrown. If the modules are mapped to
different loaders then it will work.
Relevant draft API: http://j.mp/1Lq5QVY
- Mark
More information about the jpms-spec-experts
mailing list