报告将 groovy.lang.GString 对象用作映射键的语句。 通常,GString 对象是可变的,可能不应用作键。 此外,使用具有相同值的 java.lang.String 对象无法访问 GString 条目。

示例:


def map = [:]
def key = 'foo'
map << ["${key}": 'bar']
assert map[key] == null // confusing 'true' result of comparison

2017.1 的新功能