[ 
https://issues.apache.org/jira/browse/JEXL-302?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17030755#comment-17030755
 ] 

Dmitri Blinov commented on JEXL-302:
------------------------------------

Maybe I'm kicking a dead horse here, but can you please explain the logic 
behind {{x.y[['z', 't']]}}
{code:java}
    @Test
    public void testLiteral() throws Exception {
        JexlScript e = JEXL.createScript("x.y[['z', 't']]");
        Set<List<String>> vars = e.getVariables();
        Assert.assertEquals(1, vars.size());
        Assert.assertTrue(eq(mkref(new String[][]{{"x", "y", "[ 'z', 't' ]"}}), 
vars));
    } {code}
Why do we expect the last "[ 'z', 't' ]" part? How is it differ from, for 
instance, {{x.y['z' + 't']}} in a sense that both {{'z' + 't'}} and {{['z', 
't']}} are just expressions?

> JexlScript.getVariables returns strange values for array access
> ---------------------------------------------------------------
>
>                 Key: JEXL-302
>                 URL: https://issues.apache.org/jira/browse/JEXL-302
>             Project: Commons JEXL
>          Issue Type: Bug
>    Affects Versions: 3.1
>            Reporter: Dmitri Blinov
>            Assignee: Henri Biestro
>            Priority: Minor
>             Fix For: 3.2
>
>
> I can not understand the logic behind the current implementation of 
> {{JexlScript.getVariables()}} method. From the documentation we know that the 
> result should be the set of script variables. For the code
> {code:java}
> a[b][c]{code}
> it gives three variables {{a}}, {{b}}, {{c}}. So far so good. But for the code
> {code:java}
> a[b]['c']{code}
> it returns {{a}} and {{b c}}, where second variable has two fragments {{b}} 
> and {{c}}. The documentation states that variables with multiple fragments 
> are ant-ish variables, but I don't have any of ant-ish variables in the 
> example, and {{'c'}} is not a variable, but a constant. I expect to get {{a}} 
> and {{b}} as a result.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to