Java 9+ modules support


#1

Hi!
Can you add java9+ modules support to java-client?

Now it fails on boot

/Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home/bin/java "-javaagent:/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar=59693:/Applications/IntelliJ IDEA CE.app/Contents/bin" -Dfile.encoding=UTF-8 -p /Users/elvis/prog/java/couchbase-client-java-10/target/classes:/Users/elvis/.m2/repository/com/couchbase/client/java-client/2.5.5/java-client-2.5.5.jar:/Users/elvis/.m2/repository/com/couchbase/client/core-io/1.5.5/core-io-1.5.5.jar:/Users/elvis/.m2/repository/io/reactivex/rxjava/1.3.4/rxjava-1.3.4.jar:/Users/elvis/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.9.5/jackson-core-2.9.5.jar -m testcouchbase/com.my.pack.Main
Error occurred during initialization of boot layer
java.lang.module.FindException: Unable to derive module descriptor for /Users/elvis/.m2/repository/com/couchbase/client/core-io/1.5.5/core-io-1.5.5.jar
Caused by: java.lang.module.InvalidModuleDescriptorException: Provider class com.fasterxml.jackson.core.JsonFactory not in module

Example here - https://github.com/lelvisl/couchbase-client-java-10


#2

Hi there. Thanks for the suggestion, it’s always good to get feedback on what developers want from our SDKs. After some initial research we think we can support it, and I’ll be continuing the investigation and subsequent work on ticket https://issues.couchbase.com/browse/JCBC-1193 if you want to follow along.


#3

Just to update you, this is now going through code review and should be in a forthcoming release (though I don’t have an exact ETA for you at this stage).

To set expectations, this is a) going to solve the InvalidModuleDescriptionException you’ve found, and b) set the Automatic-Module-Name to one more appropriate than the currently auto-guessed one (so that will need a minor change in your app). It’s not going to make the jars into full ‘proper’ Java 9 modules, which we can’t do currently as we need to compile with JDK6. Still, it will solve the issue here.