You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Sergiu Dumitriu (JIRA)" <ji...@apache.org> on 2016/07/18 20:37:20 UTC

[jira] [Updated] (VELOCITY-806) Can't access map values when get(Object key) is overriden

     [ https://issues.apache.org/jira/browse/VELOCITY-806?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergiu Dumitriu updated VELOCITY-806:
-------------------------------------
    Fix Version/s:     (was: 2.x)

> Can't access map values when get(Object key) is overriden
> ---------------------------------------------------------
>
>                 Key: VELOCITY-806
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-806
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.7
>            Reporter: Mateusz Matela
>            Assignee: Claude Brisson
>            Priority: Minor
>
> I try to add a java.util.Map instance to Velocity context and access its values from a template, for example: ${map.get("someKey")}
> It doesn't work if use my own implementation of Map.get(Object key). It doesn't matter whether I implement Map from scratch, or subclass HashMap and override the get(Object key) metho. The get method is never called and the engine output is: ${map.get("someKey")}. 
> It does work if I use my own subclass of HashMap without overriding the get(Object key) method.
> It does work if I use my own implementation of Map with the get(String key) method added: the get(String key) is called instead of get(Object key).
> It does work if I use my class that doesn't implement Map, but has a get(Object key) method.
> More discussion of this on Velocity-User mailing list: http://old.nabble.com/Can%27t-acces-map-values-when-get%28%29-is-overriden-td31955214.html



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org