[ http://issues.apache.org/jira/browse/VELOCITY-449?page=comments#action_12432862 ] Nathan Bubna commented on VELOCITY-449: ---------------------------------------
get(key) is also part of the map interface. yet we give it special syntactic treatment on all objects, map or not. if a put(Object, Object) method exists, it is not meaningless. it is meant to be used. why force a different syntax for an identical method? i really think that given our support of get() on any object; the burden of explanation is on the restriction to Map. "treat like methods alike" seems like a better, simpler, and less surprising policy than "treat like methods alike unless they fail to declare that they implement a particular interface" :) > Velocity Uberspector behaves differently for get(String) and put(String, > Object) methods > ---------------------------------------------------------------------------------------- > > Key: VELOCITY-449 > URL: http://issues.apache.org/jira/browse/VELOCITY-449 > Project: Velocity > Issue Type: Bug > Affects Versions: 1.5 > Reporter: Henning Schmiedehausen > Fix For: 1.5 > > > Consider an Object > public class Test { > private Object foo; > public Object get(String dummy) { return foo; } > public void put(String dummy, Object foo) { this.foo = foo }; > } > Put this object into a Velocity Context as $test, add a HashMap as $map. > Use the following template: > $map.put("key", "val1") > $test.put("key", "val1") > $map.get("key") --> Returns val1 > $test.get("key") --> Returns val1 > $map.key --> Returns val1 > $test.key --> Returns val1 > #set ($map.key = "val2") > #set ($test.key = "val2") > $map.key --> Returns val2 > $test.key --> Returns val1 !! > The reason for this is, that the UberspectorImpl, in getPropertySet tests in > line 247 whether the passed object is assignable to a Map. This test is no in > the getPropertyGet > and seems to have no reason because the following method lookup for "put" > will succeed anyway. > I'd suggest the removal of this test. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
