Problem with Java-9+

Uri the Great <[email protected]> Fri, 13 Sep 2019 16:36:31 -0400
Newsgroups gmane.comp.encryption.bouncy-castle.devel
Organization MIT
Message-ID <[email protected]>
As I resurrected one of my Maven-based projects that retrieve
BouncyCastle jars from the Maven Central, I discovered that bcprov-ext
jars for 1.61+ are incompatible with the previous releases, in a way
that's both bad and unnecessary.

Before 1.61, /module-info.class/ was not added, so for Java-1.8 (and
before) it worked as expected - and for Java-9+ it took the name of the
jar file as the module name. So far so good - it worked with all the JDK
around.

Now comes 1.61. Somebody decided that it's a good thing to give a
special name to the bcprov module - /org.bouncycastle.provider/. So, the
projects are no longer portable across different JDK and BC releases -
because now they have to list dependency for /org.bouncycastle.provider/
if they use BC 1.61+, or for /bcprov-ext-jdk15on/ if they use BC 1.60 or
earlier.

I think the correct solution would be to set module name to
/bcprov-ext-jdk15on/ (or /bcprov-jdk15on/ correspondingly), if you want
to be backward-compatible.

A nit: there's no JDK-1.9, so it might be better to rename your
.../jdk1.9... /to /...jdk-9.../ or /...jdk9.../

P.S. Thanks for including /add_module.sh/. It's helpful. May I suggest
changing /export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/ to
something more dynamic, like /export JAVA_HOME=`/usr/libexec/java_home
-v 11`/