When executing in module mode, the java command doesn't show the verifyError message details

forax at univ-mlv.fr forax at univ-mlv.fr
Sat Mar 23 15:49:53 UTC 2019


----- Mail original -----
> De: "Alan Bateman" <Alan.Bateman at oracle.com>
> À: "Remi Forax" <forax at univ-mlv.fr>
> Cc: "core-libs-dev" <core-libs-dev at openjdk.java.net>
> Envoyé: Samedi 23 Mars 2019 16:09:07
> Objet: Re: When executing in module mode, the java command doesn't show the verifyError message details

> On 23/03/2019 13:17, forax at univ-mlv.fr wrote:
>> :
>>
>> /usr/jdk/jdk-13/bin/java -Xlog:init=debug --enable-preview --module-path
>> target/main/artifact:deps -m fr.umlv.lazystaticfinal
>> Error: Unable to initialize main class fr.umlv.lazystaticfinal.Main in module
>> module fr.umlv.lazystaticfinal
>> Caused by: module fr.umlv.lazystaticfinal: java.lang.VerifyError
>>
> You first mail had:
> 
> Error occurred during initialization of boot layer
> java.lang.module.FindException: Module org.objectweb.asm.util not found,
> required by fr.umlv.lazystaticfinal
> 
> which suggests that org.objectweb.asm.util wasn't observable. Running
> -Xlog:init-debug should have reveal more for that case.
> 
> It looks like you've got past that now and are hitting the same
> VerifyError.

in my original email, i've cut and paste the wrong lines, at that point i had already resolved the FindException (the dependency modules in folder deps were not in the module path)

> In the launcher, the resources corresponding to the two
> cases are java.launcher.cls.error7 and java.launcher.module.error5 so I
> would expect the exception message from the VerifyError to be printed in
> both. I suspect you'll need to run with -verbose and look at the class
> loading order to give some hint as to whether the message may be getting
> lost.

found the issue, it's more simple :)

If you take a look to the error message, the module name is printed twice:
 Error: Unable to initialize main class fr.umlv.lazystaticfinal.Main in module module fr.umlv.lazystaticfinal
   Caused by: module fr.umlv.lazystaticfinal: java.lang.VerifyError  

so the issue is here
  http://hg.openjdk.java.net/jdk/jdk/file/c81fbf340ceb/src/java.base/share/classes/sun/launcher/resources/launcher.properties#l245
it should be
  Caused by: {2}: {3}
instead of
  Caused by: {1}: {2}
because {1} is the name of the module, not the name of the exception.

> 
> -Alan

Rémi


More information about the core-libs-dev mailing list