<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 20:08:23 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-2] Naming conflict appears when key of list is constructed from leaf with name key</title>
                <link>https://jira.opendaylight.org/browse/MDSAL-2</link>
                <project id="10137" key="MDSAL">mdsal</project>
                    <description>&lt;p&gt;With following statement in yang model: &lt;/p&gt;

&lt;p&gt;list property {&lt;br/&gt;
    key &quot;key&quot;;&lt;br/&gt;
    leaf key &lt;/p&gt;
{
        type string;
    }
&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;exception is thrown:&lt;/p&gt;

&lt;p&gt;java.lang.ClassCastException: org.opendaylight.yangtools.binding.generator.util.Types$ConcreteTypeImpl cannot be cast to org.opendaylight.yangtools.sal.binding.model.api.GeneratedTransferObject&lt;br/&gt;
	at org.opendaylight.yangtools.sal.java.api.generator.BuilderTemplate.generateConstructor(BuilderTemplate.java:1006)&lt;br/&gt;
	at org.opendaylight.yangtools.sal.java.api.generator.BuilderTemplate.body(BuilderTemplate.java:398)&lt;br/&gt;
	at org.opendaylight.yangtools.sal.java.api.generator.BaseTemplate.generate(BaseTemplate.java:73)&lt;br/&gt;
	at org.opendaylight.yangtools.sal.java.api.generator.BuilderGenerator.generate(BuilderGenerator.java:58)&lt;br/&gt;
	at org.opendaylight.yangtools.sal.java.api.generator.GeneratorJavaFile.generateTypeToJavaFile(GeneratorJavaFile.java:126)&lt;br/&gt;
	at org.opendaylight.yangtools.sal.java.api.generator.GeneratorJavaFile.generateToFile(GeneratorJavaFile.java:73)&lt;/p&gt;

&lt;p&gt;This is caused because of 2 methods with same name (getKey) are generated, first for list statement to get key, second as a getter for leaf node.&lt;/p&gt;</description>
                <environment>&lt;p&gt;Operating System: All&lt;br/&gt;
Platform: PC&lt;/p&gt;</environment>
        <key id="26824">MDSAL-2</key>
            <summary>Naming conflict appears when key of list is constructed from leaf with name key</summary>
                <type id="10100" iconUrl="https://jira.opendaylight.org/secure/viewavatar?size=xsmall&amp;avatarId=10310&amp;avatarType=issuetype">Improvement</type>
                                                <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="mvitez@cisco.com">Martin Vitez</reporter>
                        <labels>
                    </labels>
                <created>Wed, 20 Nov 2013 10:35:45 +0000</created>
                <updated>Mon, 4 Jun 2018 15:45:33 +0000</updated>
                            <resolved>Mon, 4 Jun 2018 15:45:33 +0000</resolved>
                                                    <fixVersion>Fluorine</fixVersion>
                                    <component>Binding codegen</component>
                        <due></due>
                            <votes>0</votes>
                                    <watches>8</watches>
                                                                                                                <comments>
                            <comment id="53899" author="tony.tkacik@gmail.com" created="Thu, 27 Feb 2014 13:38:52 +0000"  >&lt;p&gt;Solution is to rename getter getKey(), which was added by BindingGenerator&lt;br/&gt;
to key(). Methods starting with get... should be left to be only defined by YANG.&lt;/p&gt;

&lt;p&gt;This is API breakage, so it needs to be part of binding specification v2.&lt;/p&gt;</comment>
                            <comment id="53900" author="jgloncak" created="Mon, 3 Mar 2014 07:12:14 +0000"  >&lt;p&gt;Working on it&lt;/p&gt;</comment>
                            <comment id="53901" author="jgloncak" created="Mon, 3 Mar 2014 13:18:05 +0000"  >&lt;p&gt;status changed&lt;/p&gt;</comment>
                            <comment id="53902" author="jgloncak" created="Tue, 4 Mar 2014 14:44:39 +0000"  >&lt;p&gt;According to RFC 6020 name of concrete container, leaf, leaf-list, list,&lt;br/&gt;
grouping, choice ... has to start with letter which is followed with&lt;br/&gt;
letters, digits, &apos;_&apos;, &apos;-&apos;, or &apos;.&apos; character.&lt;/p&gt;

&lt;p&gt;Before this commit there was generated for key of a list getter method&lt;br/&gt;
&apos;getKey&apos;. &apos;key&apos; word was used while getter method was constructed.&lt;br/&gt;
In this commit &apos;key$&apos; word is used. Dollar is character which can&apos;t be used in&lt;br/&gt;
YANG but can be used in JAVA. Therefore it can&apos;t happen that list&lt;br/&gt;
subelement identifier will be also &apos;key$&apos;.&lt;/p&gt;

&lt;p&gt;As was specified in bugzilla - interface (from YANG list) and implementing&lt;br/&gt;
class are generated with &apos;key()&apos; getter method and with member field &apos;_key$&apos;.&lt;br/&gt;
Builder for implementing class is generated with member field&lt;br/&gt;
&apos;_key$&apos; and with &apos;keyGet()&apos; and &apos;keySet()&apos; getter and setter methods.&lt;/p&gt;

&lt;p&gt;Name conflict for methods &apos;key()&apos;, &apos;keySet()&apos;, &apos;keyGet()&apos; is solved&lt;br/&gt;
because all methods generated from subelements of YANG list starts with&lt;br/&gt;
&apos;get&apos;, &apos;set&apos; or &apos;is&apos;.&lt;/p&gt;

&lt;p&gt;Currently all yangtools projects were succesfuly built with this change. The commit is in draft state&lt;br/&gt;
&lt;a href=&quot;https://git.opendaylight.org/gerrit/#/c/5521/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://git.opendaylight.org/gerrit/#/c/5521/&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="53903" author="jgloncak" created="Wed, 5 Mar 2014 13:22:00 +0000"  >&lt;p&gt;test if methods &apos;get()&apos;, &apos;keyGet()&apos;, &apos;keySet()&apos; are in builder, interface and interface implementation was added&lt;/p&gt;</comment>
                            <comment id="53904" author="jgloncak" created="Wed, 30 Apr 2014 07:58:54 +0000"  >&lt;p&gt;The change was rebased on 30APR2014&lt;/p&gt;</comment>
                            <comment id="53905" author="sven.wisotzky@nokia.com" created="Mon, 31 Oct 2016 09:10:39 +0000"  >&lt;p&gt;There are much more flavors of this error:&lt;br/&gt;
The problem basically always occurs, when a list has a child object named &quot;key&quot;. So I&apos;ve found a case, where a list contains a container called key which causes basically the same issue.&lt;/p&gt;

&lt;p&gt;In general I would agree, that renaming the method &quot;getKey()&quot; to something else like &quot;whatKey()&quot; would fix that issue. I am only concerned about the ongoing discussion, that getKey() might still be available for compatibility with existing &quot;yang binding v1&quot; integration projects - and it gets only removed in cases where naming conflicts occur. If going down that path, implementation should be smart enough, to not only check for leaves called &quot;key&quot; but other types like container or list as well.&lt;/p&gt;

&lt;p&gt;I am surprised that this is categorized as with importance &quot;lowest&quot; and &quot;enhancement&quot;. The thing is basically, that this break with existing vendor YANG models - as key is very likely used as YANG variable name around protocol authentication and privacy (for example BGP keychains, IPsec, ...). In my eyes this is not just a corner case - it is a bug with major severity, beside we come to such conclusion that ODL should not be flexible enough to compile any valid/existing YANG model in the market.&lt;/p&gt;</comment>
                            <comment id="53906" author="jatoth@cisco.com" created="Fri, 24 Mar 2017 10:36:30 +0000"  >&lt;p&gt;&lt;a href=&quot;https://git.opendaylight.org/gerrit/#/c/53279/10&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://git.opendaylight.org/gerrit/#/c/53279/10&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="62582" author="rovarga" created="Mon, 23 Apr 2018 21:59:02 +0000"  >&lt;p&gt;Fluorine Binding V1 is cleared for this API breakage. Builders will use &apos;withKey()&apos; instead of &apos;setKey()&apos;. This also affects augmentations, where we need to just solve &apos;getAugmentation()&apos;, renaming it to &apos;augmentation()&apos;.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10002">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="26981">MDSAL-159</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="22777">YANGTOOLS-357</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10003">
                    <name>Relates</name>
                                                                <inwardlinks description="relates to">
                                        <issuelink>
            <issuekey id="27066">MDSAL-244</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="29843">TSC-101</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_10208" key="com.atlassian.jira.plugin.system.customfieldtypes:textfield">
                        <customfieldname>External issue ID</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>157</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10201" key="com.atlassian.jira.plugin.system.customfieldtypes:url">
                        <customfieldname>External issue URL</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[https://bugs.opendaylight.org/show_bug.cgi?id=157]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10206" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Issue Type</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10308"><![CDATA[New Feature]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10204" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>ODL SR Target Milestone</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10336"><![CDATA[Carbon-RC0]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10202" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Priority</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10353"><![CDATA[Lowest]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10000" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|i02vpj:</customfieldvalue>

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