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

Henri Biestro edited comment on JEXL-302 at 5/22/19 3:28 PM:
-------------------------------------------------------------

I suspect your (failing) example is: why does {{a['b'][c]}} generate 
{{["a",”b"]}} and {{["c"]}} as the variable set of lists ?

This probably stems from the current behaviour where {{a.b}} is equivalent to 
{{a["b"]}} or {{a.0}} is equivalent to {{a[0]}}. There are plenty of tests in 
VarTests.testRef(...) that indicate the intent for getVariable to collect that 
equivalence.
It is guaranteed that the 1st member of each segment (list) is the name of a 
variable; one can consider the whole segment as the actual varying element ( as 
in a.b value changes with a and a.b ).
Does this make more sense?


was (Author: henrib):
I suspect your (failing) example is: why does {{a['b'][c]}} generate 
{{["a",”b"]}} and {{["c"]}} as the variable set of lists ?

This probably stems from the current behaviour where {{a.b]}} is equivalent to 
{{a["b"]}} or {{a.0}} is equivalent to {{a[0]}}. There are plenty of tests in 
VarTests.testRef(...) that indicate the intent for getVariable to collect that 
equivalence.
It is guaranteed that the 1st member of each segment (list) is the name of a 
variable; one can consider the whole segment as the actual varying element ( as 
in a.b value changes with a and a.b ).
Does this make more sense?

> 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
>            Priority: Minor
>
> 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
(v7.6.3#76005)

Reply via email to