Christopher Smith created GROOVY-8756:
-----------------------------------------
Summary: Use standard toString behavior for Maps
Key: GROOVY-8756
URL: https://issues.apache.org/jira/browse/GROOVY-8756
Project: Groovy
Issue Type: Wish
Reporter: Christopher Smith
Groovy overrides {{Map#toString()}} to produce a very slightly tweaked version
of the standard output that comes at the cost of direct incompatibility with
the API contracts of {{AbstractMap}}. While this is an odd glitch in most
cases, the fact that even an explicit attempt to call {{map.toString()}}
produces different behavior introduces compatibility problems with classes
written in other languages; as a common example, using Spock to test Java
classes that include maps in their {{toString()}} becomes... challenging.
As Groovy already has the explicit {{toMapString()}} available, there is no
means to opt out of contract-breaking changes, and (as described in
GROOVY-5954) the output differs based on static or dynamic compilation, I
request that in 3.0 {{Map#toString()}} revert to the JDK-based behavior,
retaining {{toMapString()}} for when the Groovy style is desired.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)