Unnamed module and duplicate package
Alex Buckley
alex.buckley at oracle.com
Fri Mar 11 21:56:28 UTC 2016
On 3/11/2016 2:04 AM, Neil Bartlett wrote:
>> On 11 Mar 2016, at 08:50, Alan Bateman <Alan.Bateman at oracle.com>
>> wrote:
>> The transaction API is one of a small number of APIs shared between
>> Java SE and EE. The complete set is non-aggregator modules that
>> java.se.ee requires. In the case of the transaction API then Java
>> SE defines the minimum subset of javax.transaction required to
>> support the mapping of CORBA system exceptions to RMI exceptions.
>> The Java Language to IDL Mapping spec has the details. Java SE
>> defines all the types in javax.transacation.xa, important because
>> JDBC supports XA.
>
> Whatever the motivation, I referred to this package as “broken”
> because it has caused a great many problems for OSGi users.
> Applications that import the javax.transaction package may encounter
> NoClassDefFoundError due to the missing types if they wire to the
> platform export. The most commonly employed practical solution is to
> add back those types with the application ClassLoader.
>
> A properly constructed set of OSGi bundles *should* never throw
> NoClassDefFoundError or ClassNotFoundException, and I would hope this
> will also be the case in Jigsaw.
For a set of consistently compiled modules with no unchecked warnings,
the JPMS guarantees the JVM will never throw NoClassDefFoundError, nor
ClassCastException due to heap pollution ("no unchecked warnings") or
split packages (as 'requires' != Require-Bundle).
Per Alan's comment, guaranteeing no ClassNotFoundException is impossible
because consistently compiled code can use Class::forName with random
strings.
Alex
More information about the jigsaw-dev
mailing list