Uploaded image for project: 'Commons JEXL'
  1. Commons JEXL
  2. JEXL-105

Array literals are considered constant even when they are not

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.1
    • Fix Version/s: 2.1
    • Labels:
      None
    • Environment:

      JDK 1.6 SE on Windows XP

      Description

      JexlContext context = new MapContext();
      Expression selectExp = new JexlEngine().createExpression("[a.propA]");
      context.set("a", new A("a1", "p1"));
      System.out.println(Arrays.toString((Object[])selectExp.evaluate(context)));

      -->[p1]

      //selectExp = new JexlEngine().createExpression("[a.propA]");
      context.set("a", new A("a2", "p2"));
      System.out.println(Arrays.toString((Object[])selectExp.evaluate(context)));

      --> [p1] correct answer should be [p2]

      // A's class definition
      public class A {

      String nameA;

      String propA;

      public A(String nameA, String propA)

      { this.nameA = nameA; this.propA = propA; }

      @Override
      public String toString()

      { return "A [nameA=" + nameA + ", propA=" + propA + "]"; }

      public String getNameA()

      { return nameA; }

      public String getPropA()

      { return propA; }

      }

        Attachments

          Activity

            People

            • Assignee:
              henrib Henri Biestro
              Reporter:
              cary.thompson Cary Thompson
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: