Uploaded image for project: 'mdsal'
  1. mdsal
  2. MDSAL-763

Fix generation of constructor parameters for BitsTypeObject

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Medium Medium
    • 14.0.0
    • None
    • Binding codegen

      Constructor parameters for BitsTypeObject are generated in the wrong order. Correct order has to be based on the position of individual bits.

      For this typedef:

          typedef my-bits {
              type bits {
                  bit bit-zero {
                      position 0;
                  }
                  bit bit-one {
                      position 1;
                  }
                  bit bit-two {
                      position 2;
                  }
              }
              default "bit-one";
          }
      

      We end up emitting:

      public class MyBits
       implements BitsTypeObject, Serializable {
          private static final long serialVersionUID = -6378126414559401958L;
          private final Boolean _bitZero;
          private final Boolean _bitOne;
          private final Boolean _bitTwo;
      
      
          public MyBits(Boolean _bitOne,  Boolean _bitTwo, Boolean _bitZero) {
          
              this._bitZero = _bitZero;
              this._bitOne = _bitOne;
              this._bitTwo = _bitTwo;
          }
      }
      

      Apart from some kind of illogical arrangement, it causes the wrong assignment of arguments through super(), in the case of restricted bit types.

            ivanm1996 Ivan Martiniak
            ivanm1996 Ivan Martiniak
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: