[MDSAL-458] Binding V1 fails to generate code with union leaf named same as parent Created: 24/Jun/19  Updated: 27/Jun/19  Resolved: 27/Jun/19

Status: Resolved
Project: mdsal
Component/s: Binding codegen
Affects Version/s: 3.0.8, 4.0.2
Fix Version/s: 3.0.9, 4.0.3

Type: Bug Priority: Medium
Reporter: Juraj Veverka Assignee: Robert Varga
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File maven-build.log     XML File pom.xml     File test-model@2019-06-24.yang    

 Description   

Some combinations of nested leafs and unions causes generation of invalid binding code.
See attached example module test-model@2019-06-24.yang and maven-build.log

Reproduced with neon and sodium releases.  

 

 



 Comments   
Comment by Robert Varga [ 25/Jun/19 ]

Minimal test case:

  choice exported {
    // implies 'case exported-to'
    leaf exported-to {
      type union {
        type enumeration {
          enum "netconf";
          enum "cli";
        }
        type string;
      }
    }
  }

i.e. we are in ExportedTo case and are attempting to create ExportedTo nested class, which is not allowed by JLS.

 

Comment by Robert Varga [ 26/Jun/19 ]

This also affects type bits and is not specific to choice/case, as the following fails, too:

  container exported-to {
    leaf exported-to {
      type union {
        type enumeration {
          enum "netconf";
          enum "cli";
        }
        type string;
      }
    }
  }
Generated at Wed Feb 07 20:09:51 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.