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

Jonathan Gibbons jonathan.gibbons at oracle.com
Mon Dec 5 21:39:27 UTC 2016



On 12/04/2016 12:36 AM, Alan Bateman wrote:
> On 04/12/2016 00:07, Remi Forax wrote:
>
>> 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
>>
> I've created JDK-8170708 to track this.
>
> -Alan.

There are three issues here:

1. Accessing module-info.class in a .jar file

     It may be extreme, javap will accept URLs, including jar: URLs, as 
a way of referencing any .class
     file in a .jar file.

2. Better handling of "this_class 0"

3. How to identify the module declaration on the javap command line. 
i.e. should javap be changed
     to special case the name module-info?

-- Jon


More information about the jigsaw-dev mailing list