fix 6387: groovysh completion for maps with 'class' entry

Should now work for instances having class member neither null
nor instanceof Class, as long as getClass() returns a Class instance.

See https://jira.codehaus.org/browse/GROOVY-6387

Signed-off-by: Thibault Kruse <kruset@in.tum.de>
useless function call
more code style, using class member instead of getClass Method
Merge pull request #266 from tkruse/fix6387

fix 6387: groovysh completion for maps with 'class' entries
code style (readability: scope)
GROOVY-6389: groovysh: Print results using toString(), not String.valueOf

Using java.lang.String.valueOf(obj) for instances of Arrays and Maps causes
Object.toString to be used for String generation, causing ugly output in groovysh

This commit uses toString() instead which uses pretty output for collections.

As opposed to an earlier commit for Groovy 2.2, Arrays will be displayed
without their type. Avoiding the GString here because of the earlier code
comment, not sure whether there is any risk using GString here or not
(Comment was from 2007, e222d4f5cf8cc7).
replace other occurences of String.valueOf in groovysh