Inspectopedia Help

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.


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


Groovy, 233.SNAPSHOT

Last modified: 13 July 2023