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

Henning Schmiedehausen closed VELOCITY-109.
-------------------------------------------


> failed to call overloaded method in foreach loop when item changes class type
> -----------------------------------------------------------------------------
>
>                 Key: VELOCITY-109
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-109
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.3-rc1
>         Environment: Operating System: Windows XP
> Platform: PC
>            Reporter: Hacking Bear
>         Assigned To: Velocity-Dev List
>
> 1 create a class with two overloaded methods like
> public class Helper {
>    public String getFoo(Integer v) { return "int "+v; }
>    public String getFoo(String v) { return "str "+v; }
> }
> 2. put an instance of Helper and a collection containing two items of 
> different types
> col = new ArrayList();
> col.add(new Integer(100));
> col.add("STRVALUE");
> ctx.put("helper", new Helper());
> ctx.put("col", col);
> 3. in a template, do
> #foreach ( $item in $col )
> ${helper.getFoo($item)
> #end
> 4. evaluate the template and you should see
> int 100
> ${helper.getFoo($item)
> The error: the second item should invoke getFoo(String) but it apparently 
> fails and causing the invocation failure.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to