javap is not able to read the module-info.class if in a jar

Remi Forax forax at univ-mlv.fr
Sun Dec 4 00:07:47 UTC 2016


Hi all, hi Jon,
while updating ASM6 to the new classfile format, i think i've found a bug in javap.

javap as no trouble to read module-info.class if the class is specified directly
$ /usr/jdk/jdk-9-jigsaw/bin/javap module-info.class 
open module com.google.guava {
  requires java.base;
  requires java.logging;
  requires java.annotations.common;
  requires jdk.unsupported;
  exports com.google.common.io;
  ...
}

but if the module-info.class is in a (modular) jar,
/usr/jdk/jdk-9-jigsaw/bin/javap --module-path deps -m com.google.guava module-info
Error: error while reading constant pool for module-info: invalid index #0

The error is due i believe to the fact that the code used here was not updated to the latest spec, which requires the class name of a module inside the bytecode to be null.

I use:
  java version "9-ea"
  Java(TM) SE Runtime Environment (build 9-ea+146-jigsaw-nightly-h5781-20161129)
  Java HotSpot(TM) 64-Bit Server VM (build 9-ea+146-jigsaw-nightly-h5781-20161129, mixed mode)

The other possibility is that i've a bug in the ClassWriter of ASM ...

regards,
Rémi

PS: i strongly believe that setting the class name to null instead of 'module-info' is stupid because i had to update a bunch of ASM visitors to avoid NPEs.



More information about the jigsaw-dev mailing list