Ok, got it to work by patching the default module this package comes from: -Xpatch:java.annotations.common=mods\javax.annotation.prior...@1.0.jar
The name of the module was kind of misleading (different than packages inside). I kept trying to patch javax.annotation... also, I couldn't get it to work with upgrademodulepath, no matter how hard I tried (copied java.annotations.common.jmod verbatim, created a modular jar out of it). Everything falls to pieces with: > java -upgrademodulepath mods -cp . Test Error occurred during initialization of VM java.lang.module.ResolutionException: Unable to compute the hash of module java.base at java.lang.module.Resolver.fail(java.base@9-ea/Resolver.java:796) at java.lang.module.Resolver.checkHashes(java.base@9-ea/Resolver.java:457) at java.lang.module.Resolver.finish(java.base@9-ea/Resolver.java:274) at java.lang.module.Configuration.<init>(java.base@9-ea/Configuration.java:187) at java.lang.module.Configuration.resolveRequiresAndUses(java.base@9-ea/Configuration.java:346) at jdk.internal.module.ModuleBootstrap.boot(java.base@9-ea/ModuleBootstrap.java:217) at java.lang.System.initPhase2(java.base@9-ea/System.java:1916) Dawid On Thu, Apr 7, 2016 at 11:40 AM, Dawid Weiss <dawid.we...@gmail.com> wrote: >> thank you for the detailed response! I am reassured that there is a >> reasonable technical solution, yet this seems like quite a burden for >> end users of JavaSE embedding any of these popular libraries. > > I just hit the same issue with JBoss RestEasy. We have an embedded > server (not EE class, a simple servlet with some web services > exposed), but RestEasy relies on annotations in jaxrs > (javax.annotation.*, javax.ws.rs.*). I tried to somehow make it work, > but failed so far. Please correct me if I'm wrong, but from my > investigation of this list archives it seems that it's impossible to > simply "add" the JAR with the missing annotations to classpath? I need > to compile those annotations to a module and then add the module, > right? > > If so then it makes it extra difficult to have an interoperable build > script (and tests) for Java 8 and 9. > > Dawid > > > On Tue, Apr 5, 2016 at 1:24 PM, Alan Bateman <alan.bate...@oracle.com> wrote: >> On 05/04/2016 12:09, Sanne Grinovero wrote: >>> >>> Hi Alan, >>> thank you for the detailed response! I am reassured that there is a >>> reasonable technical solution, yet this seems like quite a burden for >>> end users of JavaSE embedding any of these popular libraries. >>> >>> I'll be looking forward to hear more about this, in the meantime I'll >>> post my doubts to the Java Platform Module System EG. >> >> I don't know if you saw the recent change to JEP 261 [1] but I think this >> should make things easier. >> >> -Alan >> >> [1] http://mail.openjdk.java.net/pipermail/jigsaw-dev/2016-April/007209.html