Hi folks,

Another issue deserving a chance for folks to discuss if they see any issues:

https://issues.apache.org/jira/browse/GROOVY-11893

https://github.com/apache/groovy/pull/2424

It stems from an issue that I recently closed but was over 8 years old.

https://github.com/apache/groovy/pull/566

The crux is that there are times when folks might want to turn off
Groovy's "friendly" map and array printing. The PR provides a way to
do that by moving that functionality into groovyToString extension
methods and the allow that to be disabled using the existing
groovy.extension.disable system property. The upside is folks can add
their own groovyToString methods for other types if they wish.

TLDR:

$ groovy -e "println ([array1: 1..3 as int[], array2: 1..3 as long[]])"
[array1:[1, 2, 3], array2:[1, 2, 3]]

$ export JAVA_OPTS="-Dgroovy.extension.disable=groovyToString(int[])"
$ groovy -e "println ([array1: 1..3 as int[], array2: 1..3 as long[]])"
[array1:[I@3a80515c, array2:[1, 2, 3]]

$ export JAVA_OPTS="-Dgroovy.extension.disable=groovyToString(long[])"
$ groovy -e "println ([array1: 1..3 as int[], array2: 1..3 as long[]])"
[array1:[1, 2, 3], array2:[J@60b85ba1]

$ export JAVA_OPTS="-Dgroovy.extension.disable=groovyToString(Map)"
$ groovy -e "println ([array1: 1..3 as int[], array2: 1..3 as long[]])"
{array1=[I@6c451c9c, array2=[J@31c269fd}

Cheers, Paul.

Reply via email to