<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 20:10:13 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-602] Add non-null getters for leaf objects</title>
                <link>https://jira.opendaylight.org/browse/MDSAL-602</link>
                <project id="10137" key="MDSAL">mdsal</project>
                    <description>&lt;p&gt;Experience in downstream projects shows what our @Nullable annotation in getters causes a ton of grief: Eclipse with nullness analysis is throwing up a metric ton of warnings in places where non-nullness is inferred from context or is simply not expected.&lt;/p&gt;

&lt;p&gt;For List- and Map-returning properties we already provide a sane alternative in the form of nonnullFoo(), which returns an empty List/Map.&lt;/p&gt;

&lt;p&gt;For container-like properties we can perhaps reuse &apos;nonnull&apos; prefix to return an otherwise-empty object. That should help with most of the cases, as such containers will fizzle into nothingness when they meet the datastore. This also mirrors their magic nature of disappearing.&lt;/p&gt;

&lt;p&gt;We do not have a reasonable type to return for leaf types, as there is no content we could ever garner &#8211; hence we cannot use &apos;nonnull&apos; prefix. For these we need a suitable prefix, which is TBD, and those methods should be failing if the element does not exist.&lt;/p&gt;

&lt;p&gt;We need a short, descriptive prefix for that intent and while in other context we differentiate between imperative &apos;get&apos; and java.util.Optional &apos;find&apos;, we are locked into a nullable getFoo() for historical reasons. A &apos;require&apos; prefix is the closes I can think of, but there may be another alternative. Let&apos;s assume &apos;require&apos;.&lt;/p&gt;

&lt;p&gt;The contract of &apos;requireFoo()&apos; would be such that it returns the object if it exists, but will throw a NoSuchElementException if it does not. It would be defined as a default method on the generated interface:&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 &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; DataObject {
    @Nullable &lt;span class=&quot;code-object&quot;&gt;String&lt;/span&gt; getBar();

    &lt;span class=&quot;code-keyword&quot;&gt;default&lt;/span&gt; @NonNull &lt;span class=&quot;code-object&quot;&gt;String&lt;/span&gt; requireBar() {
        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; CodeHelpers.require(getBar(), &lt;span class=&quot;code-quote&quot;&gt;&quot;bar&quot;&lt;/span&gt;);
    }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;plus CodeHelpers doing:&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;static&lt;/span&gt; &amp;lt;T&amp;gt; @NonNull T require(@Nullable T value, @NonNull &lt;span class=&quot;code-object&quot;&gt;String&lt;/span&gt; name) {
    &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (value == &lt;span class=&quot;code-keyword&quot;&gt;null&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; NoSuchElementException(&lt;span class=&quot;code-quote&quot;&gt;&quot;Value of &quot;&lt;/span&gt; + name + &lt;span class=&quot;code-quote&quot;&gt;&quot; is not present&quot;&lt;/span&gt;);
    }
    &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; value;
}&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
        <key id="33434">MDSAL-602</key>
            <summary>Add non-null getters for leaf objects</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="Kostiantyn">Kostiantyn Nosach</assignee>
                                    <reporter username="rovarga">Robert Varga</reporter>
                        <labels>
                            <label>pt</label>
                    </labels>
                <created>Sun, 18 Oct 2020 22:08:35 +0000</created>
                <updated>Wed, 21 Jul 2021 21:38:48 +0000</updated>
                            <resolved>Wed, 23 Jun 2021 19:53:43 +0000</resolved>
                                                    <fixVersion>8.0.0</fixVersion>
                                    <component>Binding codegen</component>
                        <due></due>
                            <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="69302" author="rovarga" created="Wed, 9 Jun 2021 21:27:48 +0000"  >&lt;p&gt;In the more specialized 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 foo {
  leaf bar {
    type string;
    default xyzzy;
  }
}&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;We actually can go a bit further and have:&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 &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; DataObject {
    @Nullable &lt;span class=&quot;code-object&quot;&gt;String&lt;/span&gt; getBar();

    &lt;span class=&quot;code-keyword&quot;&gt;default&lt;/span&gt; @NonNull &lt;span class=&quot;code-object&quot;&gt;String&lt;/span&gt; requireBar() {
        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; Objects.firstNonNull(getBar(), &lt;span class=&quot;code-quote&quot;&gt;&quot;xyzzy&quot;&lt;/span&gt;);
    }
}&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Note this requires interpreting &apos;default&apos; values, which may prove to be tricky and be dealt with as a subsequent improvement.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10300">
                    <name>Issue split</name>
                                            <outwardlinks description="split to">
                                        <issuelink>
            <issuekey id="34120">MDSAL-673</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10003">
                    <name>Relates</name>
                                                                <inwardlinks description="relates to">
                                        <issuelink>
            <issuekey id="34222">MDSAL-678</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|i03vfz:</customfieldvalue>

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