Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
The println behavior for strings in collections is confusing. There should be no exclamation mark in line 8 of the following script. It is particularly confusing, as the behavior is different for strings and gstrings.
import org.codehaus.groovy.runtime.InvokerHelper def g = 'g' def string = 'groovy' def gString = "${g}roovy" println string // groovy println gString // groovy println([string]) // ["groovy"] !!!!! This should be [groovy] println([string].toString()) // [groovy] System.out.println([string]) // [groovy] println([gString]) // [groovy] // The culprit assert '"groovy"' == InvokerHelper.format(string, true)
Attachments
Issue Links
- is related to
-
GROOVY-2330 GString vs String equality in collections
- Closed
-
GROOVY-2444 list of string output format changed between 1.5.0 and 1.5.1
- Closed
-
GROOVY-2458 Differences between StringBuffer.append und String +
- Closed