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

typedef/bits generates invalid code

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Highest Highest
    • 11.0.4
    • 11.0.0, 11.0.1, 11.0.2, 11.0.3
    • Binding codegen

      The following snippet (from OpenFlowJava):

        typedef table-config {
          type bits {
            bit OFPTC_DEPRECATED_MASK {
              position 3;
            }
          }
        }
      

      ends up generating the following bit of code:

          public TableConfig(boolean _oFPTCDEPRECATEDMASK) {
              this._oFPTCDEPRECATEDMASK = _oFPTCDEPRECATEDMASK;
          }
      
          public TableConfig(TableConfig source) {
              this._oFPTCDEPRECATEDMASK = source._oFPTCDEPRECATEDMASK;
          }
      
          public static TableConfig getDefaultInstance(final String defaultValue) {
              return new TableConfig(new boolean(defaultValue));
          } 

      Obviously getDefaultInstance() is completely wrong and triggers a javac failure:

      [ERROR] /home/nite/odl/openflowplugin/openflowjava/openflow-protocol-api/target/generated-sources/BindingJavaFileGenerator/org/opendaylight/yang/gen/v1/urn/opendaylight/openflow/common/types/rev130731/TableConfig.java:[51,43] '[' expected
      [ERROR] /home/nite/odl/openflowplugin/openflowjava/openflow-protocol-api/target/generated-sources/BindingJavaFileGenerator/org/opendaylight/yang/gen/v1/urn/opendaylight/openflow/common/types/rev130731/TableConfig.java:[51,57] ']' expected
      

            matusmatok Matúš Matok
            rovarga Robert Varga
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: