GString map key
Reports statements which use a groovy.lang.GString
object as a key to map. In general GString
objects are mutable and probably should not be used as keys. Also, a GString
entry cannot be accessed with a java.lang.String
object with same value.
Example:
def map = [:]
def key = 'foo'
map << ["${key}": 'bar']
assert map[key] == null // confusing 'true' result of comparison
New in 2017.1
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Groovy, 233.SNAPSHOT |
Last modified: 13 July 2023