You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Henri Biestro (JIRA)" <ji...@apache.org> on 2014/10/28 18:34:36 UTC

[jira] [Commented] (JEXL-147) Array literal with variable parts never re-evaluated

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

Henri Biestro commented on JEXL-147:
------------------------------------

On the 3.0 trunk, the issue as described does not occur:
{code}
    public void test147() throws Exception {
        JexlEngine JEXL = new Engine();
        JexlContext jc = new MapContext();
        JexlExpression e147 = JEXL.createExpression("quux = [one, two]");

        jc.set("one", 1);
        jc.set("two", 2);
        int[] o1 = (int[])e147.evaluate(jc);
        assertEquals(1, o1[0]);
        assertEquals(2, o1[1]);

        jc.set("one", 10);
        jc.set("two", 20);
        int[] o2 = (int[]) e147.evaluate(jc);
        assertEquals(10, o2[0]);
        assertEquals(20, o2[1]);
    }
{code}

> Array literal with variable parts never re-evaluated
> ----------------------------------------------------
>
>                 Key: JEXL-147
>                 URL: https://issues.apache.org/jira/browse/JEXL-147
>             Project: Commons JEXL
>          Issue Type: Bug
>    Affects Versions: 2.0.1
>            Reporter: Marcel Schoen
>            Priority: Minor
>
> Suppose there are two integer variables 'one' (with value 1) and 'two' (with value 2). Now I create an array variable with this expression:
> myArray = [ one, two ]
> Now I change the values of these variables later ('one' to 5 and 'two' to 6), and evaluate the same expression again:
> myArray = [ one, two ]
> Now I would expect "myArray" to be created again, this time with values 5 and 6. However, the second time, nothing really happens. Internally, "myArray" remains the same array from the first invocation (same Java String array object instance), with the same values (1 and 2). But since I was using variables with different values in the expression, I would expect the array to change / be re-created.



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