You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Andrew Bowman (JIRA)" <ji...@apache.org> on 2016/04/28 17:25:13 UTC

[jira] [Updated] (GROOVY-7829) the split method on string produces an unexpected data type "[Ljava.lang.String;"

     [ https://issues.apache.org/jira/browse/GROOVY-7829?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Bowman updated GROOVY-7829:
----------------------------------
    Summary: the split method on string produces an unexpected data type "[Ljava.lang.String;"  (was: the split method on string produces an unexpected data type "Ljava.lang.String;")

> the split method on string produces an unexpected data type "[Ljava.lang.String;"
> ---------------------------------------------------------------------------------
>
>                 Key: GROOVY-7829
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7829
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-runtime
>    Affects Versions: 2.4.5
>         Environment: JVM: 1.8.0_20
>            Reporter: Andrew Bowman
>            Priority: Minor
>
> def x = '123'
> def no = x.split('')
> def yes = x.collect{it}
> assert yes == ['1','2','3']
> assert no  == ['1','2','3']
> assert yes == no
> println yes.getClass()
> println no.getClass()
> println yes.remove('1')
> println no.remove('1')
> class java.util.ArrayList
> class [Ljava.lang.String;
> true
> Exception thrown
> groovy.lang.MissingMethodException: No signature of method: [Ljava.lang.String;.remove() is applicable for argument types: (java.lang.String) values: [1]
> Possible solutions: reverse(), reverse(boolean), join(java.lang.String), getAt(java.lang.String)
> 	at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:58)
> 	at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:49)
> 	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
> 	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
> 	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
> 	at ConsoleScript118.run(ConsoleScript118:71)
> 	at groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:263)
> 	at groovy.lang.GroovyShell.run(GroovyShell.java:524)
> 	at groovy.lang.GroovyShell.run(GroovyShell.java:503)
> 	at groovy.lang.GroovyShell.run(GroovyShell.java:170)
> 	at groovy.lang.GroovyShell$run$1.call(Unknown Source)
> 	at groovy.ui.Console$_runScriptImpl_closure17.doCall(Console.groovy:989)
> 	at groovy.ui.Console$_runScriptImpl_closure17.doCall(Console.groovy)
> 	at sun.reflect.GeneratedMethodAccessor746.invoke(Unknown Source)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:483)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)