artio icon indicating copy to clipboard operation
artio copied to clipboard

Library cannot be used with Java Modules

Open cowwoc opened this issue 5 years ago • 4 comments

This library cannot be used with Java Modules because it exports the same package from multiple JAR files.

  • Java Modules does not allow a module to import the same package from two different dependencies.
  • Both uk.co.real-logic:artio-core:0.31 and uk.co.real-logic:artio-codecs:0.31 export package uk.co.real_logic.artio
  • uk.co.real-logic:artio-core:0.31 depends on uk.co.real-logic:artio-codecs:0.31 so one cannot import uk.co.real-logic:artio-core:0.31

Proposed fix: Move the classes into different package so that each JAR exports a unique package name.

cowwoc avatar Jul 17 '19 19:07 cowwoc

Any thoughts on how to do this in a backwards compatible way? It's not essential to maintain compatibility, but if it is possible then it would be good to do so.

RichardWarburton avatar Jul 18 '19 10:07 RichardWarburton

Hi Richard,

You could release separate artifacts for Java9+ like guava originally did (they did it for Java8 support) and eventually turn that into the default in the next major release. With that approach you'd need to break compatibility eventually.

Another thing you could do is merge the JAR files so there is only one exporting the package and the other is empty.

Maybe someone has a third idea :)

In our own product, we opted to just break compatibility.

cowwoc avatar Jul 18 '19 11:07 cowwoc

Hey @RichardWarburton,

Did you decide how to proceed?

cowwoc avatar Sep 17 '19 14:09 cowwoc

This was perceived to be a low priority item by clients so I've not progressed it.

RichardWarburton avatar Sep 17 '19 15:09 RichardWarburton