<!-- 
RSS generated by JIRA (9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b) at Mon Feb 12 07:29:28 CET 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>Magnolia - Issue tracker</title>
    <link>https://jira.magnolia-cms.com</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-uk</language>    <build-info>
        <version>9.4.2</version>
        <build-number>940002</build-number>
        <build-date>19-01-2023</build-date>
    </build-info>


<item>
            <title>[MGNLSTK-688] Minor generics improvement</title>
                <link>https://jira.magnolia-cms.com/browse/MGNLSTK-688</link>
                <project id="10287" key="MGNLSTK">Magnolia Standard Templating Kit (closed)</project>
                    <description>&lt;p&gt;I ran into some issues concerning the use of generics: &lt;/p&gt;

&lt;p&gt;public class RenderingModelImpl&amp;lt;RD extends RenderableDefinition&amp;gt; implements RenderingModel&lt;/p&gt;

&lt;p&gt;shouldn&apos;t this be &lt;/p&gt;

&lt;p&gt;public class RenderingModelImpl&amp;lt;RD extends RenderableDefinition&amp;gt; implements RenderingModel&amp;lt;RD&amp;gt;&lt;/p&gt;

&lt;p&gt;When this is fixed it would be nice to be able to subclass both STKTemplateModel and STKTemplate while being able to access operations on the STKTemplate subclass by getDefinition() on the model class. After the previous fix this would possible without braking anything.&lt;/p&gt;

&lt;p&gt;Change:&lt;/p&gt;

&lt;p&gt;public class STKTemplateModel extends RenderingModelImpl&amp;lt;STKTemplate&amp;gt;&lt;/p&gt;

&lt;p&gt;to &lt;/p&gt;

&lt;p&gt;public class STKTemplateModel&amp;lt;RD extends STKTemplate&amp;gt; extends RenderingModelImpl&amp;lt;RD&amp;gt;&lt;/p&gt;

&lt;p&gt;using this constructor:     &lt;/p&gt;

&lt;p&gt;public STKTemplateModel(Content content, RD definition, RenderingModel parent) &lt;/p&gt;
{
        super(content, definition, parent);
    }</description>
                <environment></environment>
        <key id="19125">MGNLSTK-688</key>
            <summary>Minor generics improvement</summary>
                <type id="4" iconUrl="https://jira.magnolia-cms.com/secure/viewavatar?size=xsmall&amp;avatarId=10890&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="6" iconUrl="https://jira.magnolia-cms.com/images/icons/priorities/neutral.gif">Neutral</priority>
                        <status id="6" iconUrl="https://jira.magnolia-cms.com/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="1">Fixed</resolution>
                                        <assignee username="fgrilli">Federico Grilli</assignee>
                                    <reporter username="roekoe">Roelof Jan</reporter>
                        <labels>
                            <label>generics</label>
                    </labels>
                <created>Thu, 14 Oct 2010 15:43:22 +0200</created>
                <updated>Wed, 19 Jan 2011 16:11:37 +0100</updated>
                            <resolved>Wed, 19 Jan 2011 12:34:28 +0100</resolved>
                                    <version>1.3</version>
                    <version>1.3.1</version>
                    <version>1.3.2</version>
                    <version>1.3.3</version>
                    <version>1.3.4</version>
                    <version>1.3.5</version>
                                    <fixVersion>1.4.2</fixVersion>
                                    <component>base system</component>
                        <due></due>
                            <votes>0</votes>
                                    <watches>0</watches>
                                                                                                                <comments>
                            <comment id="30500" author="pbaerfuss" created="Wed, 20 Oct 2010 10:43:13 +0200"  >&lt;p&gt;Seams to make much sense to me.&lt;/p&gt;</comment>
                            <comment id="32016" author="gjoseph" created="Fri, 17 Dec 2010 13:05:56 +0100"  >&lt;p&gt;Patches for the above. Makes sense to me but needs an issue in MAGNOLIA. What are the consequences for existing classes, is this breaking binary compatbility ?&lt;/p&gt;</comment>
                            <comment id="32057" author="roekoe" created="Mon, 20 Dec 2010 10:15:35 +0100"  >&lt;p&gt;The compiler uses &quot;type erasure&quot; to maintain binary compatibility. The actual type arguments are not available at runtime. As for the first issue, you might consider it a bug, since a generic interface is implemented with a raw type. The last fix is mainly a compile time issue as well. It could at best make some casts obsolete when subclassing STKTemplate.&lt;/p&gt;</comment>
                            <comment id="32695" author="fgrilli" created="Thu, 13 Jan 2011 17:37:56 +0100"  >&lt;p&gt;Hello Roelof, &lt;br/&gt;
I tried to apply the changes you suggested but had weird problems for instance in &lt;tt&gt;info.magnolia.module.templatingkit.style.BodyClassResolver.resolveBodyClass(STKTemplateModel)&lt;/tt&gt; where at line 93&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;final&lt;/span&gt; STKTemplate def = model.getDefinition();&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt; I needed to cast the result of &lt;tt&gt;getDefintion()&lt;/tt&gt; to &lt;tt&gt;STKTemplate&lt;/tt&gt; in order to compile the class. Same problem with &lt;tt&gt;info.magnolia.module.templatingkit.style.CssSelectorBuilder.createCssSelector(RenderingModelImpl)&lt;/tt&gt; and &lt;tt&gt;info.magnolia.module.templatingkit.templates.SingletonParagraphTemplateModel.execute()&lt;/tt&gt;. Did you, by chance, encounter the same problems? If so, how did you solve them? &lt;/p&gt;</comment>
                            <comment id="32741" author="roekoe" created="Mon, 17 Jan 2011 11:02:25 +0100"  >&lt;p&gt;In the Hudson change log I only see a patch for STKTemplate. Did you fix RenderingModelImpl as well by appending &amp;lt;RD&amp;gt;:&lt;/p&gt;

&lt;p&gt;public class RenderingModelImpl&amp;lt;RD extends RenderableDefinition&amp;gt; implements RenderingModel&amp;lt;RD&amp;gt; &amp;lt;-- !!!&lt;/p&gt;

&lt;p&gt;In the old version subclasses of RenderingModelImpl return the raw type (RenderableDefinition) and not the declared generic subtype, in your case STKTemplate. &lt;/p&gt;

</comment>
                            <comment id="32742" author="fgrilli" created="Mon, 17 Jan 2011 11:25:29 +0100"  >&lt;p&gt;Yes, we applied the patch for &lt;tt&gt;RenderingModelImpl&lt;/tt&gt; too (rev. 41257) but for some strange reason hudson change log does not show it.&lt;/p&gt;</comment>
                            <comment id="32750" author="roekoe" created="Mon, 17 Jan 2011 12:02:10 +0100"  >&lt;p&gt;I have an incomplete checkout, which projects (svn paths) should I checkout to reproduce this?&lt;/p&gt;</comment>
                            <comment id="32752" author="fgrilli" created="Mon, 17 Jan 2011 12:22:06 +0100"  >&lt;p&gt;OK, the reason why &lt;tt&gt;RenderingModelImpl&lt;/tt&gt; changes were not shown here is not so strange as that class belongs to the magnolia-module-templating in the main project. So to reproduce the issue you need magnolia 4.4 branch and stk trunk. The patches were reverted, so you need to apply them again. Thanks.&lt;/p&gt;</comment>
                            <comment id="32760" author="roekoe" created="Mon, 17 Jan 2011 14:03:13 +0100"  >&lt;p&gt;This applies to all STKTemplateModel subclasses which now can provide their own renderable definition.&lt;/p&gt;</comment>
                            <comment id="32762" author="fgrilli" created="Mon, 17 Jan 2011 14:59:19 +0100"  >&lt;p&gt;Thanks. &lt;/p&gt;</comment>
                            <comment id="32764" author="fgrilli" created="Mon, 17 Jan 2011 15:11:10 +0100"  >&lt;p&gt;Applied patch. Java compiler type erasure will keep binary compatibility.&lt;/p&gt;</comment>
                            <comment id="32769" author="fgrilli" created="Mon, 17 Jan 2011 15:42:38 +0100"  >&lt;p&gt;Maybe I was too rushed into resolving this. As far as I can understand, binary compatibility will not be an issue but backward compatibility will. If fact, if someone has extended &lt;tt&gt;STKTemplateModel&lt;/tt&gt; 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;&lt;span class=&quot;code-keyword&quot;&gt;class &lt;/span&gt;Foo &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; STKTemplateModel{

	&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; Foo(Content content, STKTemplate definition, RenderingModel parent) {
		&lt;span class=&quot;code-keyword&quot;&gt;super&lt;/span&gt;(content, definition, parent);
	}

	@Override
	&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;code-object&quot;&gt;String&lt;/span&gt; execute() {
		STKTemplate template = getDefinition();
                &lt;span class=&quot;code-comment&quot;&gt;//&lt;span class=&quot;code-keyword&quot;&gt;do&lt;/span&gt; something here
&lt;/span&gt;		&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;super&lt;/span&gt;.execute();
	}

}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;when they will upgrade to the latest stk they will incur in compilation issues as &lt;tt&gt;getDefinition()&lt;/tt&gt; will either need a cast or their custom template model will need to specify the type like this &lt;tt&gt;class Foo extends STKTemplateModel&amp;lt;STKTemplate&amp;gt;&lt;/tt&gt; as we did in &lt;tt&gt;info.magnolia.module.templatingkit.templates.SingletonParagraphTemplateModel&lt;/tt&gt;&lt;/p&gt;</comment>
                            <comment id="32771" author="fgrilli" created="Mon, 17 Jan 2011 15:48:28 +0100"  >&lt;p&gt;I also noticed that, strangely, overriding &lt;tt&gt;getDefinition()&lt;/tt&gt; in &lt;tt&gt;info.magnolia.module.templatingkit.templates.STKTemplateModel&amp;lt;RD&amp;gt;&lt;/tt&gt; 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;@Override
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; RD getDefinition() {
    	&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;super&lt;/span&gt;.getDefinition();
    }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;will make the need for casting or type specification useless.&lt;/p&gt;</comment>
                            <comment id="32773" author="gjoseph" created="Mon, 17 Jan 2011 16:18:52 +0100"  >&lt;p&gt;Roelof Jan, thanks for the new patches. I think this is +/- what we originally committed.. and reverted. We felt that introducing the need for casting somehow reduced the benefits of generics here. But I&apos;m assuming you had other benefits elsewhere in your own modules gained with this. Would you be so kind so as to explain a little ? So we can make a sound decision&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.magnolia-cms.com/images/icons/emoticons/wink.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                            <comment id="32775" author="roekoe" created="Mon, 17 Jan 2011 16:26:55 +0100"  >&lt;p&gt;Interesting. This was what I had expected as a default although this behavior is somewhat obvious when looking closely at it. This might facilitate backward compatibility when compiling against newer versions of your codebase, which certainly is an issue in the applied patches. &lt;/p&gt;</comment>
                            <comment id="32777" author="roekoe" created="Mon, 17 Jan 2011 16:42:16 +0100"  >&lt;p&gt;@Gregory I Just missed your post. We often subclass STKTemplate with a subclass definition. Now with getDefinition we must check and cast to our subclass definition. Generics can solve this easily, I thought. Overriding getDefinition in STKTemplate is apparently necessary to keep the returns type in sync with the old statically defined return type. &lt;/p&gt;

&lt;p&gt;This still is a minor issue. The RenderingDefinitionImpl declaration looks like a bug to me. STKTemplateModel improvements should not brake any code. Besides there is still a lot work to do in these parts, this is just a single issue.&lt;/p&gt;</comment>
                            <comment id="32792" author="fgrilli" created="Tue, 18 Jan 2011 11:24:35 +0100"  >&lt;p&gt;And so we went for applying the patch along with the overriding of &lt;tt&gt;getDefinition()&lt;/tt&gt; so not have issues when compiling existing subclasses of &lt;tt&gt;STKTemplateModel&lt;/tt&gt; against the new codebase.&lt;/p&gt;</comment>
                            <comment id="32849" author="pbaerfuss" created="Wed, 19 Jan 2011 11:36:28 +0100"  >&lt;p&gt;Changes in BodyClassResolver and CSSSelectorBuilder were not undone.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10020">
                    <name>dependency</name>
                                            <outwardlinks description="depends upon">
                                        <issuelink>
            <issuekey id="19827">MAGNOLIA-3497</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="14093" name="MGNLSTK-688-1.patch" size="766" author="gjoseph" created="Fri, 17 Dec 2010 13:05:56 +0100"/>
                            <attachment id="14094" name="MGNLSTK-688-2.patch" size="1119" author="gjoseph" created="Fri, 17 Dec 2010 13:05:56 +0100"/>
                            <attachment id="14195" name="MGNLSTK-688-STK.patch" size="3723" author="roekoe" created="Mon, 17 Jan 2011 14:03:13 +0100"/>
                            <attachment id="14194" name="MGNLSTK-688-Templating.patch" size="818" author="roekoe" created="Mon, 17 Jan 2011 14:03:13 +0100"/>
                            <attachment id="13824" name="RenderingModelImpl.java" size="2871" author="roekoe" created="Thu, 14 Oct 2010 15:43:22 +0200"/>
                            <attachment id="13825" name="STKTemplateModel.java" size="9885" author="roekoe" created="Thu, 14 Oct 2010 15:43:22 +0200"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                            <customfield id="customfield_14166" key="com.okapya.jira.checklist:checklist">
                        <customfieldname>Acceptance criteria</customfieldname>
                        <customfieldvalues>
                            
        <checklist>
        <![CDATA[
                            




                
                                    <div class="o-completion" style="display: flex; flex-shrink: 0;"><span  class="aui-lozenge aui-lozenge-complete" style="font-size: 12px; font-weight: normal; display: flex; flex-direction: row; align-items: center;" ><span style="padding-right: 4px; vertical-align: middle;"><svg width="15" height="15" viewBox="0 0 15 15" xmlns="http://www.w3.org/2000/svg" fill="white"><path clip-rule="evenodd" d="m10.41037,3.42544l-7.86501,0c-0.72395,0 -1.31084,0.58688 -1.31084,1.31084l0,7.86508c0,0.7239 0.58689,1.3108 1.31084,1.3108l7.86501,0c0.724,0 1.3109,-0.5869 1.3109,-1.3108l0,-7.86508c0,-0.72396 -0.5869,-1.31084 -1.3109,-1.31084zm-7.86501,-0.65542c-1.08593,0 -1.96626,0.88032 -1.96626,1.96626l0,7.86508c0,1.0859 0.88033,1.9662 1.96626,1.9662l7.86501,0c1.086,0 1.9663,-0.8803 1.9663,-1.9662l0,-7.86508c0,-1.08594 -0.8803,-1.96626 -1.9663,-1.96626l-7.86501,0z" fill-rule="evenodd"/><path d="m5.09049,10.18526l-1.82767,-1.82766l-0.78479,0.78479l2.61246,2.61246l5.38758,-5.38754l-0.78483,-0.78479l-4.60275,4.60274z"/></svg></span><span>Empty</span></span></div>
                        ]]>
    </checklist>


                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10111" key="com.atlassian.jira.toolkit:reporterdomain">
                        <customfieldname>Company</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>vpro.nl</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10031" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of First Response</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Wed, 20 Oct 2010 10:43:13 +0200</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_12730" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_14151" key="com.atlassian.jira.toolkit:message">
                        <customfieldname>Docu info</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10061" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comm is not jira-dev</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10071" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last participant</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>mmuehlebach</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_13136" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            13 years, 5 weeks, 4 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                            <customfield id="customfield_10020" key="com.atlassian.jira.toolkit:attachments">
                        <customfieldname>Number of attachments</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>6.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10150" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname>Number of comments</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>18.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10011" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>fgrilli</customfieldvalue>
            <customfieldvalue>gjoseph</customfieldvalue>
            <customfieldvalue>pbaerfuss</customfieldvalue>
            <customfieldvalue>roekoe</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10090" key="com.atlassian.jira.plugin.system.customfieldtypes:multicheckboxes">
                        <customfieldname>Patch included</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10100"><![CDATA[Yes]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10833" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|i042wv:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10244" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>23914</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_14145" key="com.intenso.jira.issue-templates:issue-templates-customfield">
                        <customfieldname>Template</customfieldname>
                        <customfieldvalues>
                            


                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                            <customfield id="customfield_15131" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Time in Discovery</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10032" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time in Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        </customfields>
    </item>
</channel>
</rss>