<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 20:10: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-736] Improve Decimal64 validity checks</title>
                <link>https://jira.opendaylight.org/browse/MDSAL-736</link>
                <project id="10137" key="MDSAL">mdsal</project>
                    <description>&lt;p&gt;Our current checks currently look 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;
 &#160;&#160;&#160;&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; Range&amp;lt;Decimal64&amp;gt;[] CHECK_VALUERANGE_RANGES;

 &#160;&#160;&#160;&lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; {
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;@SuppressWarnings(&lt;span class=&quot;code-quote&quot;&gt;&quot;unchecked&quot;&lt;/span&gt;)
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;span class=&quot;code-keyword&quot;&gt;final&lt;/span&gt; Range&amp;lt;Decimal64&amp;gt;[] a = (Range&amp;lt;Decimal64&amp;gt;[]) Array.newInstance(Range.class, 1);
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;a[0] = Range.closed(Decimal64.of(2, 7777L), Decimal64.of(2, 11111L));
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;CHECK_VALUERANGE_RANGES = a;
 &#160;&#160;&#160;}

 &#160;&#160;&#160;&lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; void check_valueRange(&lt;span class=&quot;code-keyword&quot;&gt;final&lt;/span&gt; org.opendaylight.yangtools.yang.common.Decimal64 value) {
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; (Range&amp;lt;Decimal64&amp;gt; r : CHECK_VALUERANGE_RANGES) {
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (r.contains(value)) {
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt;;
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;}

 &#160;&#160;&#160;&#160;&#160;&#160;&#160;CodeHelpers.throwInvalidRange(CHECK_VALUERANGE_RANGES, value);
 &#160;&#160;&#160;}

 &#160;&#160;&#160;@ConstructorParameters(&lt;span class=&quot;code-quote&quot;&gt;&quot;value&quot;&lt;/span&gt;)
 &#160;&#160;&#160;@ConstructorProperties(&lt;span class=&quot;code-quote&quot;&gt;&quot;value&quot;&lt;/span&gt;)
 &#160;&#160;&#160;&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; MyDerivedDecimal2(Decimal64 _value) {
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;span class=&quot;code-keyword&quot;&gt;super&lt;/span&gt;(_value);

 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&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;) {
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;check_valueRange(_value);
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;}

 &#160;&#160;&#160;&#160;&#160;&#160;&#160;CodeHelpers.requireValue(_value);
 &#160;&#160;&#160;}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;This has one major omission: we do not check Decimal64.scale(), which should always be matching fraction-digits.&lt;/p&gt;

&lt;p&gt;Once we check that, we can also improve performance and memory footprint: if the scale matches, then the range checks can be performed on the unscaled value &#8211; i.e. for a similar cost as our uint32/uint64 checks.&lt;/p&gt;

&lt;p&gt;Once we are in the area, we should also clean up the layout of the above:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;the requireValue return should be used for field initialization, or&lt;/li&gt;
	&lt;li&gt;if we have superclass (as above) it should be omitted&lt;/li&gt;
	&lt;li&gt;since we have non-nullness established, there is no need for the if (_value != null) guard&lt;/li&gt;
&lt;/ul&gt;
</description>
                <environment></environment>
        <key id="35341">MDSAL-736</key>
            <summary>Improve Decimal64 validity checks</summary>
                <type id="10103" iconUrl="https://jira.opendaylight.org/secure/viewavatar?size=xsmall&amp;avatarId=10311&amp;avatarType=issuetype">New Feature</type>
                                            <priority id="3" iconUrl="https://jira.opendaylight.org/images/icons/priorities/major.svg">Medium</priority>
                        <status id="10001" iconUrl="https://jira.opendaylight.org/" description="">In Review</status>
                    <statusCategory id="4" key="indeterminate" colorName="yellow"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="ivanhrasko">Ivan Hrasko</assignee>
                                    <reporter username="rovarga">Robert Varga</reporter>
                        <labels>
                            <label>pt</label>
                    </labels>
                <created>Mon, 14 Mar 2022 01:04:06 +0000</created>
                <updated>Mon, 22 Jan 2024 13:45:54 +0000</updated>
                                                            <fixVersion>14.0.0</fixVersion>
                    <fixVersion>13.0.1</fixVersion>
                                    <component>Binding codegen</component>
                        <due></due>
                            <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                    <issuelinks>
                            <issuelinktype id="10000">
                    <name>Blocks</name>
                                                                <inwardlinks description="is blocked by">
                                        <issuelink>
            <issuekey id="26907">MDSAL-85</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|i041tb:</customfieldvalue>

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