Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-67011

bridge-method-injector creates questionable bytecode

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • core
    • None
    • 1.25

      as per https://bugs.eclipse.org/bugs/show_bug.cgi?id=424952#c5

      Here's what happens:

      Byte code processing of Node.class duplicates the constant pool entry "Class hudson.model.Node". The class header refers to the entry at #245, whereas the InnerClasses structure refers to the same class using entry #84.

      ------------------------------------------------
      Classfile hudson/model/Node.class
      ...
        this_class: #245                        // hudson/model/Node
      ...
      Constant pool:
      ...
         #84 = Class              #368          // hudson/model/Node
      ...
        #245 = Class              #368          // hudson/model/Node
      ...
      InnerClasses:
        public static final #99= #98 of #84;    // Mode=class hudson/model/Node$Mode of class hudson/model/Node
        public static #102= #101 of #84;        // InternalComputerListener=class hudson/model/Node$InternalComputerListener of class hudson/model/Node
        public static #193= #192 of #330;       // Task=class hudson/model/Queue$Task of class hudson/model/Queue
        public static final #198= #197 of #330; // BuildableItem=class hudson/model/Queue$BuildableItem of class hudson/model/Queue
        #22;                                    // class hudson/model/Node$1
        public static #332= #53 of #330;        // FlyweightTask=class hudson/model/Queue$FlyweightTask of class hudson/model/Queue
        #79;                                    // class hudson/model/Node$2
        public static final #398= #250 of #396; // FormException=class hudson/model/Descriptor$FormException of class hudson/model/Descriptor
        public static #414= #413 of #20;        // WeightFunction=class hudson/util/TagCloud$WeightFunction of class hudson/util/TagCloud
      ------------------------------------------------
      

      Thus, when reading the inner classes structure, ecj does not find any entry that matches the current class (#245) and BinaryTypeBinding#memberTypes will remain empty.

      While not explicit in JVMS, ecj assumes that constant pool entries are unique.

      Making ecj more robust against irregular class file formats is not a priority. Rather, the authors of the "bridge-method-injector" Maven plugin should make sure they don't create redundant constant pool entries. In fact I don't see any reason why they should even start to modify the class header.

            basil Basil Crow
            teilo James Nord
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: