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

Remi Forax forax at univ-mlv.fr
Sat Mar 23 12:36:15 UTC 2019

Hi all,
When you run a main class which contains an invalid bytecode sequence using the class-path you get:

/usr/jdk/jdk-13/bin/java --enable-preview --class-path target/main/artifact/fr.umlv.lazystaticfinal-1.0.jar fr.umlv.lazystaticfinal.Main
Error: Unable to initialize main class fr.umlv.lazystaticfinal.Main
Caused by: java.lang.VerifyError: Method expects a return value
Exception Details:
    fr/umlv/lazystaticfinal/Main.HOME_lazy()Ljava/nio/file/Path; @2: return
    Error exists in the bytecode
    0000000: 1241 b1                                

if you run the same code using the module-path, you get

/usr/jdk/jdk-13/bin/java --enable-preview --module-path target/main/artifact -m fr.umlv.lazystaticfinal
Error occurred during initialization of boot layer
java.lang.module.FindException: Module org.objectweb.asm.util not found, required by fr.umlv.lazystaticfinal

the exception details corresponding to the VerifyError are not printed making the issue hard to debug.


More information about the core-libs-dev mailing list