<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 20:10:49 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-740] Generate fields for all Identityrefs in an Union binding class.</title>
                <link>https://jira.opendaylight.org/browse/MDSAL-740</link>
                <project id="10137" key="MDSAL">mdsal</project>
                    <description>&lt;p&gt;Yang allows adding multiple identityrefs as possible types in an Union. For example:&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;
identity compliance-code-identity {
  description
    &lt;span class=&quot;code-quote&quot;&gt;&quot;Base identity &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; reporting pluggable compliance codes per port.&quot;&lt;/span&gt;;
} 

identity network-phy-code-identity {
  description
    &lt;span class=&quot;code-quote&quot;&gt;&quot;base identity &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; network phy code.&quot;&lt;/span&gt;;
}
  
identity client-phy-code-identity {
  description
    &lt;span class=&quot;code-quote&quot;&gt;&quot;base identity &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; client phy code.&quot;&lt;/span&gt;;
}

type union {
  type identityref { base compliance-code-identity; }
  type identityref { base client-phy-code-identity; }
  type identityref { base network-phy-code-identity; }
  type uint64;
  type decimal64 {
    fraction-digits 8;
  } 
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;However when MDSAL generates binding class for this union, it only contains the first Identityref specified. In this case the&#160;compliance-code-identity.&lt;br/&gt;
 Binding generator processes the &quot;identityref&quot; as an ordinary &quot;type&quot; and therefore it ignores multiple occurencies of it, just as it does for any other type. But Identityref isn&apos;t an ordinary type, so it should be processed differently.&lt;br/&gt;
 The result is as follows:&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-keyword&quot;&gt;class &lt;/span&gt;ComplianceCodesUnion &lt;span class=&quot;code-keyword&quot;&gt;implements&lt;/span&gt; TypeObject, Serializable {
  &lt;span class=&quot;code-keyword&quot;&gt;private&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-object&quot;&gt;long&lt;/span&gt; serialVersionUID = -3780142905034216089L;
  &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;code-object&quot;&gt;Class&lt;/span&gt;&amp;lt;? &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; ComplianceCodeIdentity&amp;gt; _identityref;
  &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;final&lt;/span&gt; BigInteger _uint64;
  &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;final&lt;/span&gt; BigDecimal _decimal64;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Modify the binding generator to include all the identityrefs.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="35419">MDSAL-740</key>
            <summary>Generate fields for all Identityrefs in an Union binding class.</summary>
                <type id="10100" iconUrl="https://jira.opendaylight.org/secure/viewavatar?size=xsmall&amp;avatarId=10310&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="4" iconUrl="https://jira.opendaylight.org/images/icons/priorities/minor.svg">Low</priority>
                        <status id="5" iconUrl="https://jira.opendaylight.org/images/icons/statuses/resolved.png" description="A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.">Resolved</status>
                    <statusCategory id="3" key="done" colorName="green"/>
                                    <resolution id="10000">Done</resolution>
                                        <assignee username="ojo">Oleksandr Zharov</assignee>
                                    <reporter username="tibor.kral">Tibor Kr&#225;l</reporter>
                        <labels>
                    </labels>
                <created>Mon, 4 Apr 2022 12:51:29 +0000</created>
                <updated>Mon, 13 Jun 2022 14:21:08 +0000</updated>
                            <resolved>Mon, 13 Jun 2022 14:20:57 +0000</resolved>
                                                    <fixVersion>10.0.0</fixVersion>
                                    <component>Binding codegen</component>
                        <due></due>
                            <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="70717" author="rovarga" created="Fri, 8 Apr 2022 21:08:23 +0000"  >&lt;p&gt;This proposal cannot work with current mapping based on &lt;a href=&quot;https://docs.oracle.com/javase/specs/jls/se8/html/jls-4.html#jls-4.6&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;Java Language Specification&lt;/a&gt;. Most notably this proposal ignores &lt;a href=&quot;https://docs.oracle.com/javase/specs/jls/se8/html/jls-4.html#jls-4.8&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;pre-Java-1.5 world&lt;/a&gt; &amp;#8211; and that aspect of the language is not going to change in &lt;a href=&quot;https://en.wikipedia.org/wiki/Generics_in_Java&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;foreseeable future&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="70800" author="tibor.kral" created="Mon, 11 Apr 2022 12:36:29 +0000"  >&lt;p&gt;Java won&apos;t allow us to simply generate one constructor for each idetityref like this:&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; ComplianceCodesUnion(&lt;span class=&quot;code-object&quot;&gt;Class&lt;/span&gt;&amp;lt;? &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; ComplianceCodeIdentity&amp;gt; _identityref) {...}
&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; ComplianceCodesUnion(&lt;span class=&quot;code-object&quot;&gt;Class&lt;/span&gt;&amp;lt;? &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; ClientPhyCodeIdentity&amp;gt; _identityref) {...}
&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; ComplianceCodesUnion(&lt;span class=&quot;code-object&quot;&gt;Class&lt;/span&gt;&amp;lt;? &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; NetworkPhyCodeIdentity&amp;gt; _identityref) {...}&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;because these constructors have the same signature. This means any solution which proposes a separate constructor for each Identityref will completely change the API and break backwards compatibility.&lt;/p&gt;

&lt;p&gt;However there is a possible solution, which introduces an aggregare constructor for all identityrefs. It sacrifices a bit of type-safety, but should remain backwards-compatible:&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;
ComplianceCodesUnion(&lt;span class=&quot;code-object&quot;&gt;Class&lt;/span&gt;&amp;lt;? &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; BaseIdentity&amp;gt; identity) {
   &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (isValidIdentity(identity, ComplianceCodeIdentity.class)) {
       _complianceCodeIdentity = (&lt;span class=&quot;code-object&quot;&gt;Class&lt;/span&gt;&amp;lt;? &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; ComplianceCodeIdentity&amp;gt;) identity;
   } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (isValidIdentity(identity, ClientPhyCodeIdentity.class)) {
       _clientPhyCodeIdentity = (&lt;span class=&quot;code-object&quot;&gt;Class&lt;/span&gt;&amp;lt;? &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; ClientPhyCodeIdentity&amp;gt;) identity;
   } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (isValidIdentity(identity, NetworkPhyCodeIdentity.class)) { 
       _networkPhyCodeIdentity = (&lt;span class=&quot;code-object&quot;&gt;Class&lt;/span&gt;&amp;lt;? &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; NetworkPhyCodeIdentity&amp;gt;) identity; }
   &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; {
       &lt;span class=&quot;code-keyword&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; InvalidIdentityException(&lt;span class=&quot;code-quote&quot;&gt;&quot;Missing identityref &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; identity &quot;&lt;/span&gt; + identity.getName());
   }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                            <comment id="70801" author="rovarga" created="Mon, 11 Apr 2022 12:55:58 +0000"  >&lt;p&gt;Well, this completely drops compile-time safety. What about before-and-after class shape comparison?&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10000">
                    <name>Blocks</name>
                                                                <inwardlinks description="is blocked by">
                                        <issuelink>
            <issuekey id="35337">MDSAL-733</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|i041yn:</customfieldvalue>

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