Unwrapping of TemplateSequenceModel to array - backport to 2.3.x?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Unwrapping of TemplateSequenceModel to array - backport to 2.3.x?

Attila Szegedi
Hi Daniel,

do you see any backward compatibility problems if I backported the  
"Unwrapping of TemplateSequenceModel to Java array" feature that I just  
added to 2.4 to 2.3.x? Right now, if you have

public void f(int[] x)
{
   ...
}

And attempt to invoke it from template as

bean.f([1, 2, 3])

you get an IllegalArgumentException from java.lang.reflect.Method#invoke()  
as TemplateSequenceModel can only be unwrapped to a List at the moment  
(honestly, it'd have to be unwrappable to Collection too). Note that  
BeansWrapper is smart enough and takes into consideration the the class of  
the formal declared argument of the method, so it'd know to unwrap a  
TemplateSequenceModel to a List if the method would declare "x" to be a  
java.util.List. The only affected behaviour would be that people would no  
longer get an exception attempting to pass a sequence literal to a method  
expecting a Java array.

Attila.

--
home: http://www.szegedi.org
weblog: http://constc.blogspot.com

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: Unwrapping of TemplateSequenceModel to array - backport to 2.3.x?

Daniel Dekany
Thursday, December 21, 2006, 12:00:58 PM, Attila Szegedi wrote:

> Hi Daniel,
>
> do you see any backward compatibility problems if

(Me? What... Am I now the official Seer of BC Issues and Other 1000th
Order Glitches, or just simply the most fussy man around? :))

> I backported the
> "Unwrapping of TemplateSequenceModel to Java array" feature that I just
> added to 2.4 to 2.3.x? Right now, if you have
>
> public void f(int[] x)
> {
>    ...
> }
>
> And attempt to invoke it from template as
>
> bean.f([1, 2, 3])
>
> you get an IllegalArgumentException from
> java.lang.reflect.Method#invoke()  
> as TemplateSequenceModel can only be unwrapped to a List at the moment
> (honestly, it'd have to be unwrappable to Collection too). Note that  
> BeansWrapper is smart enough and takes into consideration the the class of
> the formal declared argument of the method, so it'd know to unwrap a  
> TemplateSequenceModel to a List if the method would declare "x" to be a
> java.util.List. The only affected behaviour would be that people would no
> longer get an exception attempting to pass a sequence literal to a method
> expecting a Java array.
>
> Attila.

I think this should be backported. Actually I'm so optimistic about
2.4 (i.e. if it well ever be released), that you can backport other BC
improvements as well, after all -- don't forget -- your family is less
important than FreeMarker. ;)

--
Best regards,
 Daniel Dekany


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: Unwrapping of TemplateSequenceModel to array - backport to 2.3.x?

Attila Szegedi
On Thu, 21 Dec 2006 15:45:28 +0100, Daniel Dekany <[hidden email]>  
wrote:

> Thursday, December 21, 2006, 12:00:58 PM, Attila Szegedi wrote:
>
>> Hi Daniel,
>>
>> do you see any backward compatibility problems if
>
> (Me? What... Am I now the official Seer of BC Issues and Other 1000th
> Order Glitches, or just simply the most fussy man around? :))
>

In fact, I like to think about you as our grumpy, but very insightful  
Backward Compatibility Policy (not to be confused with Police) Officer :-)

> I think this should be backported. Actually I'm so optimistic about
> 2.4 (i.e. if it well ever be released), that you can backport other BC
> improvements as well, after all -- don't forget -- your family is less
> important than FreeMarker. ;)

Ah, a true Christmas thought :-) I doubt I can beat you at the level of  
nerdiness, though. I'm thinking of your post to this list titled "WS  
stripping bug" whose timestamp was "2002 december 31. 23:10:11" :-)  
Jonathan's "Problems with taglib scopes" post dated "2003. january 1.  
3:21:29" wons the second place :-)

Attila.

--
home: http://www.szegedi.org
weblog: http://constc.blogspot.com

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel