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

Wrongly generated java code using derived type

XMLWordPrintable

      leaf foo that is of derrived type STRING which is string with some pattern restriction. And this derived type is further more restricted with length which is valid will generate java code that is invalid as follows
       
      generated code:
             

      BarImpl(BarBuilder base) {
                   super(base.augmentation);
                   if (base.key() != null) {
                       this.key = base.key();
                   } else {
                       this.key = new BarKey(base.getFoo());
                   }
                   this._foo = key.getFoo();
               }

       
      where _foo is:

      private final STRING _ruleKey

       
      and getfoo is:

      public String getRuleKey() { return _ruleKey; }

       

      reproducer model:

      module foo {
        namespace "foo";
        prefix "foo";
        import bar {prefix exa;}
      
        grouping option60-match-rules {
          description "Option60 Match Rules";
              
          leaf rule-key {
            description "Key of rule";
            type exa:STRING {
              length "1..32";
            }
          }        
        }
      
        augment "/exa:config" {
          container cpe-image-mgmt {    
            container match-rule {
              description "Match rules configuration";
              list option60 {
                key "rule-key";
                uses option60-match-rules;
              }
            }
          }
        }
      }
      
      
      module bar {
        namespace "bar";
        prefix exa;
        include bar-types;
      
        container config;
      }
      
      
      submodule bar-types {
        belongs-to bar {
          prefix exa;
        }
      
        typedef STRING {
          type string{
            pattern "(.*)";
          }
          description "string";
        }
      }

       

            Unassigned Unassigned
            miro.kovac Miroslav Kovac
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: