Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
Not sure what "component" implements this behaviour. Tested with JSR-6, but I think it's the same in RC1
This is my original mail to the list:
==================
groovy> def i= 10
groovy> def gstr= "hello $i"
groovy> println "gstr is a GString? ${gstr instanceof GString}"
groovy> println "gstr is a String? ${gstr instanceof String}"
groovy> def str= "hello 12"
groovy> println "str is a GString? ${str instanceof GString}"
groovy> println "str is a String? ${str instanceof String}"
gstr is a GString? true
gstr is a String? false
str is a GString? false
str is a String? true
Now...
groovy> gstr as String[]
Result: ["hello 10"]
However...
groovy> str as String[]
Result: ["h", "e", "l", "l", "o", " ", "1", "2"]
So GString's when converted to String[] produce a one-element array with the whole GString
But String's when converted to String[] produce an array with one element per character in the String
(This is Groovy JSR-06)
BarZ
=============
And Graeme Rocher's reply:
=============
Hi Barz,
Please raise an issue, this behaviour is not correct
Hi Barz,
=============
Now, what I don't know: what should the CORRECT BEHAVIOUR be???