On 07/04/2016 11:26, Dawid Weiss wrote:
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

I'm curious what the following lists for you:

java -Xpatch:java.annotations.common=mods/javax.annotation.prior...@1.0.jar -listmods:java.annotations.common

The EE version of this API has additional package such as javax.annotation.security and javax.annotation.sql. If your JAR file has those then they will not be exported by default and so you might also need to run with -XaddExports.

In any case, the right way to deploy with the upgraded version is:

   -upgrademodulepath mods/javax.annotat...@1.2.jar

where the JAR file has a compiled module declaration to declare the module, its dependences, and exports.


The name of the module was kind of misleading (different than packages
inside).
The naming is unfortunate but that is what JSR-250 claims to be be.


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)

Hacking the packaged modules will fall foul of integrity checks. This suggests to me that you didn't actually create or compile a module-info.java.

-Alan

Reply via email to