GRECLIPSE
  1. GRECLIPSE
  2. GRECLIPSE-554

[inferencing] Groovy-like way of accessing map values not recognized by inferencing engine

    Details

    • Number of attachments :
      0

      Description

      In this code:

      def h = [:]
      h.foo = "value"
      print h.foo
      

      Both references of 'foo' are underlined, but they should not be. Also, 'foo' does not appear in content assist, but it should.

      Grails uses this kind of map accessing extensively, and so it should be fixed.

      I'm not sure of the best way forward here. There are several ways to fix this:

      1. Assume all references that have an object type of Map, are ok and have a type of Object. This remove the underlining above, but will not help with content assist. Also, this will mask truly incorrect references. However, it is very easy to implement.
      2. Locally keep track of all assignments to map references and remember the types of the values. This will help in the above code, but will not help if the map value is assigned non-locally.
      3. Do a combination of both. Any map reference not currently remembered is considered OK, and if it is remembered, then use the stored type. Again, this will mask truly incorrect references.

        Activity

        Hide
        Andrew Eisenberg added a comment -

        Think about this post 2.0

        Show
        Andrew Eisenberg added a comment - Think about this post 2.0
        Hide
        Andrew Eisenberg added a comment -

        probably won't get to this for 2.0.2.

        Show
        Andrew Eisenberg added a comment - probably won't get to this for 2.0.2.

          People

          • Assignee:
            Unassigned
            Reporter:
            Andrew Eisenberg
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: