Re: BeansWrapper.populateClassMapWithPropertyDescriptor failing to create property descriptors
Attila Szegedi <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
I'm sure. We never used those property setters, they're just dead weight.
BTW, couldn't you put 2.3.x branch into the GitHub too? I would happily do the backporting if it were in GitHub. I don't have much luck with doing SVN-to-git migrations (history-preserving), so can't really do it myself…
Attila.
On Nov 16, 2011, at 3:30 AM, Daniel Dekany wrote:
> Is it 100% sure that it doesn't break BC? Because then I backport this
> into 2.3.x. Otherwise the users can't take advantage of it anyway,
> since 2.4.x is not released.
>
> --
> Best regards,
> Daniel Dekany
>
>
> Tuesday, November 15, 2011, 9:07:33 PM, Attila Szegedi wrote:
>
>> Ok, made the change on Github:
>> <https://github.com/freemarker/freemarker/commit/f88a21323d5f9658728cc848152d5133444c2e63>.
>> Donnchadh, you should be able to clone the repo and build from source simply by:
>>
>> git clone git://github.com/freemarker/freemarker.git
>> cd freemarker
>> ant jar
>>
>> the JAR file will be in build/freemarker.jar
>>
>> Attila.
>>
>> On Nov 15, 2011, at 10:48 AM, Newman, John W wrote:
>>
>> sounds great to me... I can't see any reason why that block would
>> even need to bother with the write method .. just leave it as null
>> and move on. Unless .. is anyone using beanswrapper to write
>> properties? I hope not, but maybe.
>>
>> [#assign x = (bean.setY('z'))!"" /]
>>
>> ^ does that even work? If it does, it probably would even without
>> messing with the write method as it's calling setY explicitly. I
>> think the part in question with the write method is there to avoid
>> writing "get" and "set", like ${bean.x.y} = bean.getX().getY()
>> ... but is it even possible to do a direct assignment to a field in FM? I don't think so... ?
>>
>> -----Original Message-----
>> From: Donnchadh Ó Donnabháin [mailto:[email protected]]
>> Sent: Tuesday, November 15, 2011 13:34
>> To: FreeMarker-user
>> Subject: Re: [FreeMarker-user]
>> BeansWrapper.populateClassMapWithPropertyDescriptor failing to create property descriptors
>>
>> Yes, that does seem like a much simpler solution.
>>
>> Donnchadh
>>
>> On 15 November 2011 17:56, Attila Szegedi <[email protected]> wrote:
>> Actually, I don't think we use write methods at all, do we?
>> FreeMarker is only ever reading properties, never writing them. I'm
>> not even sure why I wrote the code so that it's putting the write
>> methods into the property descriptors; I guess we could just replace
>> them with nulls and thus emulate read-only properties.
>>
>> Attila.
>>
>> On Nov 15, 2011, at 7:26 AM, Donnchadh Ó Donnabháin wrote:
>> ...
>>
>> Maybe this code on line 1255 of BeansWrapper.java (FreeMarker 2.3.17):
>> pd = new PropertyDescriptor(pd.getName(),
>> publicReadMethod,
>> pd.getWriteMethod());
>>
>> could be replaced with something like this:
>>
>> Method writeMethod = pd.getWriteMethod();
>> if (writeMethod != null &&
>> (pd.getWriteMethod().getParameterTypes().length != 1
>> ||
>> pd.getWriteMethod().getParameterTypes()[0] !=
>> publicReadMethod.getReturnType())) {
>> writeMethod = null;
>> }
>> pd = new PropertyDescriptor(pd.getName(),
>> publicReadMethod, writeMethod);
>>
>> What do you think?
>>
>> Donnchadh
>>
>>
>> ------------------------------------------------------------------------------
>> RSA(R) Conference 2012
>> Save $700 by Nov 18
>> Register now
>> http://p.sf.net/sfu/rsa-sfdev2dev1
>> _______________________________________________
>> FreeMarker-user mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/freemarker-user
>> ------------------------------------------------------------------------------
>> RSA(R) Conference 2012
>> Save $700 by Nov 18
>> Register now
>> http://p.sf.net/sfu/rsa-sfdev2dev1
>> _______________________________________________
>> FreeMarker-user mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/freemarker-user
>
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d