<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 20:09:48 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-434] Fix unordered keyed list mapping</title>
                <link>https://jira.opendaylight.org/browse/MDSAL-434</link>
                <project id="10137" key="MDSAL">mdsal</project>
                    <description>&lt;p&gt;Due to legacy reasons, the following snippet:&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;
container foo {
    list bar {
        key baz;
        leaf baz {
            type string;
        }
    }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;ends up being mapped as 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;interface&lt;/span&gt; Foo {
    List&amp;lt;Bar&amp;gt; getBar();
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;which ends up being nasty for multiple reasons:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;default order-by is &quot;system&quot;, yet we are married to order-dependent List.equals(), yet&lt;/li&gt;
	&lt;li&gt;the BI layer will interpret this as a freely-reorderable Map&lt;/li&gt;
	&lt;li&gt;there is no provision to look up elements by their key and hence users must perform linear searches&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;The mapping for keyed lists with &quot;order-by system&quot;, the mapping should result in the following:&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; Foo {
    Map&amp;lt;BarKey, Bar&amp;gt; getBar();
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;which properly captures the contract here, binding use to Map.equals(). Note that unkeyed lists must not be affected, nor should the &quot;order-by user&quot; lists be changed.&lt;/p&gt;

&lt;p&gt;For dealing with user-ordered lists we will need a custom interface, which is an extension of List and provides a secondary map-like lookups, still deriving equality from List.equals().&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="31610">MDSAL-434</key>
            <summary>Fix unordered keyed list mapping</summary>
                <type id="10100" iconUrl="https://jira.opendaylight.org/secure/viewavatar?size=xsmall&amp;avatarId=10310&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="2" iconUrl="https://jira.opendaylight.org/images/icons/priorities/critical.svg">High</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="rovarga">Robert Varga</assignee>
                                    <reporter username="rovarga">Robert Varga</reporter>
                        <labels>
                    </labels>
                <created>Tue, 9 Apr 2019 18:19:44 +0000</created>
                <updated>Thu, 23 Apr 2020 13:27:07 +0000</updated>
                            <resolved>Thu, 23 Apr 2020 13:27:07 +0000</resolved>
                                                    <fixVersion>6.0.0</fixVersion>
                                    <component>Binding codegen</component>
                    <component>Binding runtime</component>
                        <due></due>
                            <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="66706" author="rovarga" created="Tue, 9 Apr 2019 18:47:10 +0000"  >&lt;p&gt;While the end result is obvious, the path towards it is not, as this change will affect a lot of users in less then subtle ways. We need to think about four primary aspects here:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;the setter in the builder&lt;/li&gt;
	&lt;li&gt;the getter in the interface&lt;/li&gt;
	&lt;li&gt;the field in the implementation&lt;/li&gt;
	&lt;li&gt;interaction with nonnull-getter&lt;/li&gt;
&lt;/ol&gt;


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

&lt;p&gt;For the setter part we can easily overload the current setter, as we can concurrently have&lt;/p&gt;

&lt;p&gt;&#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;
FooBuilder setBar(List&amp;lt;Bar&amp;gt; bar);
FooBuilder setBar(Map&amp;lt;BarKey, Bar&amp;gt; bar);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;and can simulate perform translation to either form &#8211; either through Maps.uniqueIndex() in the List-&amp;gt;Map case, or through yangtools.util.CollectionWrappers.wrapAsList(Map.values()) in the Map -&amp;gt; List case.&lt;/p&gt;

&lt;p&gt;For the getter we have two options, depending on where we want to land, but we are still restricted by simple prefix:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;getBar() returning a Map, listBar() returning a List.&lt;/li&gt;
	&lt;li&gt;getBar() returning a List, mapBar() returning a Map&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Since we are past the point of making incompatible changes in MD-SAL 4.0.0, the field (and thus equality) needs to be pinned to List. In MD-SAL 5, the internal field should become a Map, thus fixing the equality problem.&lt;/p&gt;

&lt;p&gt;As for nonnull-getter interaction, there is no neat answer here, as it really needs to follow the primary getter &#8211; unless we allocate something ugly like &apos;nonnulllist&apos; or &apos;nonnullmap&apos; to bind the secondary getter.&lt;/p&gt;

&lt;p&gt;From runtime perspective, binding-dom-codec would be most happy if it could use maps directly today.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="68042" author="rovarga" created="Thu, 23 Apr 2020 10:06:47 +0000"  >&lt;p&gt;We need a transitional setter in the builder, otherwise the migration is just too much pain for downstreams.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10003">
                    <name>Relates</name>
                                            <outwardlinks description="relates to">
                                        <issuelink>
            <issuekey id="32594">MDSAL-540</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </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|i03nfz:</customfieldvalue>

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