Skip to content

Commit

Permalink
Fix #41 : Remove unnecessary sort from map printing, closes #40
Browse files Browse the repository at this point in the history
Map sort was there originally to ensure coherent print of MethodCall args.
It is unnecessary cause Groovy map literals create LinkedHashMap, which preserves insertion order.

ClassCastException was produced due to the sort operation which used a TreeMap, resulting in a
comparison of string w/ GString, which is problematic in Groovy.
  • Loading branch information
ozangunalp committed Jun 30, 2017
1 parent bde4640 commit 231c26c
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class MethodCall {
} else if (arg instanceof Collection) {
return arg.collect { k -> toStringWithClosures(k) }
} else if (arg instanceof Map) {
return ((Map) arg).sort().collectEntries { k, v ->
return ((Map) arg).collectEntries { k, v ->
[k, v instanceof Closure ? Closure.class.name : toStringWithClosures(v)]
}
} else if (arg instanceof Script) {
Expand Down

0 comments on commit 231c26c

Please sign in to comment.