In this code:
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:
- 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.
- 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.
- 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.