Should “as Object[]” resolve GStrings?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Should “as Object[]” resolve GStrings?

OCsite
Hi there,

I've just bumped into this -- is it the intended behaviour? As always I might be missing something of importance, but it seems pretty inconsistent to me; I would assume all the objects inside should be left as-are, untouched:

groovy:000> a=["Hi ${'there'}"]
===> [Hi there]
groovy:000> (a as List)*.class
===> [class org.codehaus.groovy.runtime.GStringImpl]
groovy:000> (a as Set)*.class
===> [class org.codehaus.groovy.runtime.GStringImpl]
groovy:000> (a as ArrayList)*.class
===> [class org.codehaus.groovy.runtime.GStringImpl]
groovy:000> (a as Object[])*.class
===> [class java.lang.String]
groovy:000> 

Thanks,
OC