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

Henri Biestro resolved JEXL-154.
--------------------------------
    Resolution: Cannot Reproduce

> JEXL method lookup incorrectly interprets object array param as varargs
> -----------------------------------------------------------------------
>
>                 Key: JEXL-154
>                 URL: https://issues.apache.org/jira/browse/JEXL-154
>             Project: Commons JEXL
>          Issue Type: Bug
>    Affects Versions: 2.1.1
>            Reporter: David Loone
>            Assignee: Henri Biestro
>            Priority: Minor
>             Fix For: 3.0
>
>
> Say I have an object in my context with a method like:
> {code}
> public <T> List<T> asList(T[] array) {
>     return Arrays.asList(array);
> }
> {code}
> When I call that from a JEXL expression with something like:
> {code}
> utils.asList(["foo", "bar"])
> {code}
> The JEXL method finder seems to treat the method like a varargs method, and 
> puts the whole string array into the first element of the formal parameter, 
> rather than mapping the string array onto the object array. That is, the 
> method receives an array of length 1, with that first element being a string 
> array of length 2.
> To illustrate further, the problem goes away if I change the method to look 
> like:
> {code}
> public <T> List<T> asList(T[] array, String ... dummy) {
>     return Arrays.asList(array);
> }
> {code}
> since this forces the T[] array to be interpreted correctly.



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

Reply via email to