The module implementation uses the wrong values for ACC_TRANSITIVE and ACC_STATIC_PHASE

Remi Forax forax at univ-mlv.fr
Mon Jan 30 22:15:31 UTC 2017


Hi all,
chasing a bug on ASM, i've found that the module implementation in the JDK uses the wrong values for ACC_TRANSITIVE and ACC_STATIC_PHASE,
in the spec [1],
  0x0020 (ACC_TRANSITIVE)
  0x0040 (ACC_STATIC_PHASE)
but in the implementation [2],
  public static final int ACC_TRANSITIVE    = 0x0010;
  public static final int ACC_STATIC_PHASE  = 0x0020;  

The output of javap is wrong too (java.xml) is tagged as ACC_STATIC_PHASE with the value 20,
but 20 means ACC_TRANSITIVE !
open module org.objectweb.asm.all at 6.0_ALPHA2
  minor version: 0
  major version: 53
  flags: (0x8000) ACC_MODULE
  this_class: #2                          // "module-info"
  super_class: #0
  interfaces: 0, fields: 0, methods: 0, attributes: 1
Constant pool:
   ...
{
}
Module:
  #4,20                                   // "org.objectweb.asm.all" ACC_OPEN
  #5                                      // 6.0_ALPHA2
  2                                       // requires
    #7,8000                                 // "java.base" ACC_MANDATED
    #0
    #9,20                                   // "java.xml" ACC_STATIC_PHASE
    #0
  7                                       // exports
    #11,0                                   // org/objectweb/asm
    #13,0                                   // org/objectweb/asm/commons
    #15,0                                   // org/objectweb/asm/signature
    #17,0                                   // org/objectweb/asm/tree
    #19,0                                   // org/objectweb/asm/tree/analysis
    #21,0                                   // org/objectweb/asm/util
    #23,0                                   // org/objectweb/asm/xml
  0                                       // opens
  0                                       // uses
  0                                       // provides


This means that currently ASM is the only correct implementation of the classfile format :)

Rémi

[1] http://cr.openjdk.java.net/~mr/jigsaw/spec/lang-vm.html
[2] http://hg.openjdk.java.net/jdk9/jdk9/jdk/file/e4b19b8d4bbf/src/java.base/share/classes/jdk/internal/module/ClassFileConstants.java#l49


More information about the jigsaw-dev mailing list