Details

    • Similar Issues:

      Description

      When accessing a map key via .get() with a var replacement in the key the get operation always returns null.

       

      Example snippet:

      def map = ["key_identifier": "test"]

      def id = "identifier"
      def resA = map.get("key_identifier")
      print(resA)

      def resB = map.get("key_${id}")
      print(resB)
       
      This will return in the output:
      Test
      null

        Attachments

          Activity

          Hide
          snapstromegon Raphael Höser added a comment -

          Just in case someone stumbles upon this:
          you can use map["key_${id}"] since this works fine. I created this issue, because I wanted to use get with a default parameter and the workaround is way more ugly with if tmp == null.

          Show
          snapstromegon Raphael Höser added a comment - Just in case someone stumbles upon this: you can use map ["key_${id}"] since this works fine. I created this issue, because I wanted to use get with a default parameter and the workaround is way more ugly with if tmp == null.

            People

            • Assignee:
              Unassigned
              Reporter:
              snapstromegon Raphael Höser
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: