javap cannot read module-info.class

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

javap cannot read module-info.class

Stephan Herrmann
compile an arbitrary module-info.java and then:

$ javap module-info.class
  Error: error while reading constant pool for /tmp/bin/module-info.class: unexpected tag at #5: 19

 From tweaking the Eclipse compiler it seems that javap is expecting a CONSTANT_Utf8_info,
where according to JVMS 4.7.25 a CONSTANT_Module_info is required.

JVMS and javac agree, so javap is the odd man out.

Stephan

PS: build is 9+175
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: javap cannot read module-info.class

Remi Forax
Hi Stephan,
there is something wrong from your side, it works for me :)

/usr/jdk/jdk-9-b175/bin/javap --module-path target/main/exploded/ --module fr.umlv.asm.test module-info
Compiled from "module-info.java"
module fr.umlv.asm.test {
  requires java.base;
  requires org.objectweb.asm.all.debug;
  exports fr.umlv.asm.test;
}

/usr/jdk/jdk-9-b175/bin/javap -m java.base module-info
Compiled from "module-info.java"
module java.base@9 {
  exports sun.reflect.generics.reflectiveObjects to
    java.desktop;
  exports java.util;
  exports java.lang.ref;
  exports jdk.internal.misc to
    java.rmi,
    java.sql,
    jdk.jshell,
...

cheers,
Rémi

----- Mail original -----
> De: "Stephan Herrmann" <[hidden email]>
> À: [hidden email]
> Envoyé: Samedi 1 Juillet 2017 17:08:20
> Objet: javap cannot read module-info.class

> compile an arbitrary module-info.java and then:
>
> $ javap module-info.class
>  Error: error while reading constant pool for /tmp/bin/module-info.class:
>  unexpected tag at #5: 19
>
> From tweaking the Eclipse compiler it seems that javap is expecting a
> CONSTANT_Utf8_info,
> where according to JVMS 4.7.25 a CONSTANT_Module_info is required.
>
> JVMS and javac agree, so javap is the odd man out.
>
> Stephan
>
> PS: build is 9+175
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: javap cannot read module-info.class

Alan Bateman
In reply to this post by Stephan Herrmann


On 01/07/2017 16:08, Stephan Herrmann wrote:
> compile an arbitrary module-info.java and then:
>
> $ javap module-info.class
>  Error: error while reading constant pool for
> /tmp/bin/module-info.class: unexpected tag at #5: 19
>
> From tweaking the Eclipse compiler it seems that javap is expecting a
> CONSTANT_Utf8_info,
> where according to JVMS 4.7.25 a CONSTANT_Module_info is required.
It would be interesting to see if the runtime can read this, does "java
-p /tmp/bin --list-modules" list the module?

-Alan

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: javap cannot read module-info.class

Stephan Herrmann
In reply to this post by Remi Forax
One working example certainly doesn't prove absence of a bug :)
But yes, I must have gotten my bash aliases wrong, the reported error
is only printed by the Java 8 version of javap, in 9 it works as expected.

One small bit remains:
If I let our compiler emit CONSTANT_Utf8_info for the module name
without a wrapper CONSTANT_Module_info javap does happily accept this.
"java --list-modules" rejects this, though.

other than that: sorry for the noise,
Stephan

On 01.07.2017 18:01, Remi Forax wrote:

> Hi Stephan,
> there is something wrong from your side, it works for me :)
>
> /usr/jdk/jdk-9-b175/bin/javap --module-path target/main/exploded/ --module fr.umlv.asm.test module-info
> Compiled from "module-info.java"
> module fr.umlv.asm.test {
>    requires java.base;
>    requires org.objectweb.asm.all.debug;
>    exports fr.umlv.asm.test;
> }
>
> /usr/jdk/jdk-9-b175/bin/javap -m java.base module-info
> Compiled from "module-info.java"
> module java.base@9 {
>    exports sun.reflect.generics.reflectiveObjects to
>      java.desktop;
>    exports java.util;
>    exports java.lang.ref;
>    exports jdk.internal.misc to
>      java.rmi,
>      java.sql,
>      jdk.jshell,
> ...
>
> cheers,
> Rémi
>
> ----- Mail original -----
>> De: "Stephan Herrmann" <[hidden email]>
>> À: [hidden email]
>> Envoyé: Samedi 1 Juillet 2017 17:08:20
>> Objet: javap cannot read module-info.class
>
>> compile an arbitrary module-info.java and then:
>>
>> $ javap module-info.class
>>   Error: error while reading constant pool for /tmp/bin/module-info.class:
>>   unexpected tag at #5: 19
>>
>>  From tweaking the Eclipse compiler it seems that javap is expecting a
>> CONSTANT_Utf8_info,
>> where according to JVMS 4.7.25 a CONSTANT_Module_info is required.
>>
>> JVMS and javac agree, so javap is the odd man out.
>>
>> Stephan
>>
>> PS: build is 9+175

Loading...