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

Support array-access safe navigation (x?[y])

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.3
    • 3.4.0
    • None

    Description

      The same way the expression a?.b shortcuts evaluation and returns null if a is null, this enhancement is to have the equivalent a?['b'] return null for the same reason.

      Code example:

      var a = {:};
      a.b; // ok
      a['b'];  // ok
      a?.b; // ok
      a?['b']; // 3.3 - parsing error in ';' 

      with new JexlBuilder().safe(false).strict(true)

       

      Thanks!

      Attachments

        Activity

          People

            henrib Henri Biestro
            xupengcheng Xu Pengcheng
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: