<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 20:09:57 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>OpenDaylight JIRA</title>
    <link>https://jira.opendaylight.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>8.20.10</version>
        <build-number>820010</build-number>
        <build-date>22-06-2022</build-date>
    </build-info>


<item>
            <title>[MDSAL-503] Wrongly generated java code using derived type</title>
                <link>https://jira.opendaylight.org/browse/MDSAL-503</link>
                <project id="10137" key="MDSAL">mdsal</project>
                    <description>&lt;p&gt;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 &lt;br/&gt;
 &#160;&lt;br/&gt;
 generated code:&lt;br/&gt;
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
BarImpl(BarBuilder base) {
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;span class=&quot;code-keyword&quot;&gt;super&lt;/span&gt;(base.augmentation);
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (base.key() != &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;) {
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;.key = base.key();
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; {
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;.key = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; BarKey(base.getFoo());
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;._foo = key.getFoo();
 &#160;&#160;&#160;&#160;&#160;&#160;&#160; }&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&#160;&lt;br/&gt;
 where _foo is:&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
&lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;final&lt;/span&gt; STRING _ruleKey&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&#160;&lt;br/&gt;
 and getfoo is:&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;code-object&quot;&gt;String&lt;/span&gt; getRuleKey() { &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; _ruleKey; }&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;reproducer model:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;module foo {
  namespace &quot;foo&quot;;
  prefix &quot;foo&quot;;
  import bar {prefix exa;}

  grouping option60-match-rules {
    description &quot;Option60 Match Rules&quot;;
        
    leaf rule-key {
      description &quot;Key of rule&quot;;
      type exa:STRING {
        length &quot;1..32&quot;;
      }
    }        
  }

  augment &quot;/exa:config&quot; {
    container cpe-image-mgmt {    
      container match-rule {
        description &quot;Match rules configuration&quot;;
        list option60 {
          key &quot;rule-key&quot;;
          uses option60-match-rules;
        }
      }
    }
  }
}


module bar {
  namespace &quot;bar&quot;;
  prefix exa;
  include bar-types;

  container config;
}


submodule bar-types {
  belongs-to bar {
    prefix exa;
  }

  typedef STRING {
    type string{
      pattern &quot;(.*)&quot;;
    }
    description &quot;string&quot;;
  }
}&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="32263">MDSAL-503</key>
            <summary>Wrongly generated java code using derived type</summary>
                <type id="10104" iconUrl="https://jira.opendaylight.org/secure/viewavatar?size=xsmall&amp;avatarId=10303&amp;avatarType=issuetype">Bug</type>
                                            <priority id="2" iconUrl="https://jira.opendaylight.org/images/icons/priorities/critical.svg">High</priority>
                        <status id="10003" iconUrl="https://jira.opendaylight.org/images/icons/status_generic.gif" description="">Confirmed</status>
                    <statusCategory id="2" key="new" colorName="blue-gray"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="miro.kovac">Miroslav Kovac</reporter>
                        <labels>
                            <label>pt</label>
                    </labels>
                <created>Tue, 17 Dec 2019 15:28:21 +0000</created>
                <updated>Thu, 18 Jan 2024 17:46:00 +0000</updated>
                                                            <fixVersion>14.0.0</fixVersion>
                    <fixVersion>13.0.1</fixVersion>
                                    <component>Binding codegen</component>
                        <due></due>
                            <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="67923" author="rovarga" created="Fri, 28 Feb 2020 18:31:53 +0000"  >&lt;p&gt;Can you provide a reproducer model, please?&lt;/p&gt;</comment>
                            <comment id="67925" author="miro.kovac" created="Mon, 2 Mar 2020 09:51:05 +0000"  >&lt;p&gt;Description upgraded with models&lt;/p&gt;</comment>
                            <comment id="67926" author="rovarga" created="Mon, 2 Mar 2020 13:50:27 +0000"  >&lt;p&gt;Seems to be related to &lt;a href=&quot;https://jira.opendaylight.org/browse/MDSAL-405&quot; title=&quot;Generated unions fail to enforce patterns&quot; class=&quot;issue-link&quot; data-issue-key=&quot;MDSAL-405&quot;&gt;MDSAL-405&lt;/a&gt; and thereabout.&lt;/p&gt;</comment>
                            <comment id="69022" author="rovarga" created="Thu, 11 Mar 2021 10:35:14 +0000"  >&lt;p&gt;Okay, so this is related to typedefs and their specializations, not specific to string. The simplest reproducer is:&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
module foo {
 &#160;namespace foo;
 &#160;prefix foo;

 &#160;typedef foo {
 &#160;&#160;&#160;type binary;
 &#160;}

 &#160;container bar {
 &#160;&#160;&#160;leaf baz {
 &#160;&#160;&#160;&#160;&#160;type foo {
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;length 1;
 &#160;&#160;&#160;&#160;&#160;}
 &#160;&#160;&#160;}
 &#160;}
}

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Resulting BarBuilder&apos;s setBaz() method fails to check Foo&apos;s restrictions, as would be done for the case of:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;container bar {
  leaf baz {
    type binary {
      length 1;
    }
  }
}&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;This is most likely related to the fact that an alternative way to deal with this particular problem is to generate a class for &apos;foo&apos; specialization:&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
&lt;span class=&quot;code-keyword&quot;&gt;interface&lt;/span&gt; Bar {

  &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;class &lt;/span&gt;Baz &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; Foo {
    &lt;span class=&quot;code-comment&quot;&gt;// ...
&lt;/span&gt;  }

  &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; Baz getBaz();

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;similar in mechanics (but &lt;b&gt;not&lt;/b&gt; in overall class naming) to what would be generated for:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;module foo {
&#160; namespace foo;
 &#160;prefix foo;

 &#160;typedef foo {
 &#160;&#160;&#160;type binary;
 &#160;} 

  typedef baz {
&#160;&#160;&#160;&#160;type foo {
&#160;&#160;&#160;&#160;&#160;&#160;length 1;
&#160;&#160;&#160;&#160;}
  }

 &#160;container bar {
 &#160;&#160;&#160;leaf baz {
 &#160;&#160;&#160;&#160;&#160;type baz;
 &#160;&#160;&#160;}
 &#160;}
} &lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;We need to carefully balance the two approaches and decide which should take precendence.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="69322" author="rovarga" created="Thu, 24 Jun 2021 09:28:22 +0000"  >&lt;p&gt;We have all the infrastructure for this and I think we want to generate an enforcer in the builder. Punt to 8.0.1, where we can easily retrofit this.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10003">
                    <name>Relates</name>
                                            <outwardlinks description="relates to">
                                        <issuelink>
            <issuekey id="31194">MDSAL-405</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="relates to">
                                        <issuelink>
            <issuekey id="32262">MDSAL-502</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                            <customfield id="customfield_11400" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10000" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|i03qfj:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                </customfields>
    </item>
</channel>
</rss>