<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 20:08:43 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-130] Java Binding: improve union type implementation</title>
                <link>https://jira.opendaylight.org/browse/MDSAL-130</link>
                <project id="10137" key="MDSAL">mdsal</project>
                    <description>&lt;p&gt;Current implementation of unions which are composed solely of strings is quite wasteful, as it causes char[] duplication.&lt;/p&gt;

&lt;p&gt;A typical example from ietf-inet-types is ip-prefix. We generate the following fields:&lt;/p&gt;

&lt;p&gt;    private final Ipv4Prefix _ipv4Prefix;&lt;br/&gt;
    private final Ipv6Prefix _ipv6Prefix;&lt;br/&gt;
    private final char[] _value;&lt;/p&gt;

&lt;p&gt;We generate the default constructor for use with JMX:&lt;/p&gt;

&lt;p&gt;    @ConstructorProperties(&quot;value&quot;)&lt;br/&gt;
    public IpPrefix(char[] _value) &lt;/p&gt;
{
        java.lang.String defVal = new java.lang.String(_value);
        IpPrefix defInst = IpPrefixBuilder.getDefaultInstance(defVal);
        this._ipv4Prefix = defInst._ipv4Prefix;
        this._ipv6Prefix = defInst._ipv6Prefix;
        this._value = _value == null ? null : _value.clone();
    }

&lt;p&gt;This means that we have two copies of _value stored: one inside one of the prefixes and one retained via explicit clone.&lt;/p&gt;

&lt;p&gt;As it turns out, we do a very similar thing in both normal constructors:&lt;/p&gt;

&lt;p&gt;    public IpPrefix(Ipv4Prefix _ipv4Prefix) &lt;/p&gt;
{
        super();
        this._ipv4Prefix = _ipv4Prefix;
        this._ipv6Prefix = null;
        this._value = _ipv4Prefix.getValue().toString().toCharArray();
    }

&lt;p&gt;    public IpPrefix(Ipv6Prefix _ipv6Prefix) &lt;/p&gt;
{
        super();
        this._ipv6Prefix = _ipv6Prefix;
        this._ipv4Prefix = null;
        this._value = _ipv6Prefix.getValue().toString().toCharArray();
    }

&lt;p&gt;While this is generic and works for all types, for strings this ends up being inefficient.&lt;/p&gt;

&lt;p&gt;Generated code should be modified so that if a union has only string types, _value field should not be generated and getValue() should be implemented as:&lt;/p&gt;

&lt;p&gt;public char[] getValue() {&lt;br/&gt;
    final String str;&lt;br/&gt;
    if (_ipv4Prefix != null) &lt;/p&gt;
{
        str = _ipv4Prefix.getValue();
    }
&lt;p&gt; else if (_ipv6Prefix != null) &lt;/p&gt;
{
        str = _ipv6Prefix.getValue();
    }
&lt;p&gt; else &lt;/p&gt;
{
        throw new IllegalStateException(...);
    }
&lt;p&gt;    return str.toCharArray();&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;Also note that this sort of optimization also applies when a union member is a boolean, as there are only two possible strings accessible via Boolean.toString().&lt;/p&gt;</description>
                <environment>&lt;p&gt;Operating System: All&lt;br/&gt;
Platform: All&lt;/p&gt;</environment>
        <key id="26952">MDSAL-130</key>
            <summary>Java Binding: improve union type implementation</summary>
                <type id="10104" iconUrl="https://jira.opendaylight.org/secure/viewavatar?size=xsmall&amp;avatarId=10303&amp;avatarType=issuetype">Bug</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="-1">Unassigned</assignee>
                                    <reporter username="rovarga">Robert Varga</reporter>
                        <labels>
                    </labels>
                <created>Wed, 17 Feb 2016 23:22:59 +0000</created>
                <updated>Sat, 4 Aug 2018 01:43:24 +0000</updated>
                            <resolved>Sat, 4 Aug 2018 01:43:24 +0000</resolved>
                                                    <fixVersion>Fluorine</fixVersion>
                                    <component>Binding codegen</component>
                    <component>Binding V2 codegen</component>
                        <due></due>
                            <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                    <issuelinks>
                            <issuelinktype id="10002">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="30353">MDSAL-364</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>5378</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=5378]]></customfieldvalue>

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

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

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

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