You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Christian Lipp (JIRA)" <ji...@apache.org> on 2016/03/11 10:55:07 UTC
[jira] [Updated] (GROOVY-7786) removeElement on split result
[ https://issues.apache.org/jira/browse/GROOVY-7786?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Christian Lipp updated GROOVY-7786:
-----------------------------------
Description:
The following code
def input = '[ant, asciidoctorj, ceylon, crash, gaiden]'
def list = input.split(', ')
println list.class.canonicalName // java.lang.String[]
list.removeElement('crash')
leads to an `MissingMethodException: No signature of method: [Ljava.lang.String;.removeElement() is applicable for argument types: (java.lang.String) values: [crash]`
But when using
def input = '[ant, asciidoctorj, ceylon, crash, gaiden]'
List<String> list = input.split(', ')
println list.class.canonicalName // java.util.ArrayList
list.removeElement('crash')
everything works. This is not intuitive, I would expect my first code to work (i used it within a fluent call chain). However I know that I can use the minus call.
was:
The following code
def input = '[ant, asciidoctorj, ceylon, crash, gaiden]'
def list = input.split(', ')
println list.class.canonicalName // java.lang.String[]
list.removeElement('crash')
leads to an `MissingMethodException: No signature of method: [Ljava.lang.String;.removeElement() is applicable for argument types: (java.lang.String) values: [crash]`
But when using
def input = '[ant, asciidoctorj, ceylon, crash, gaiden]'
List<String> list = input.split(', ')
println list.class.canonicalName // java.util.ArrayList
list.removeElement('crash')
everything works. This is not intuitive, I would expect my first code to work (i used it within a fluent call chain).
> removeElement on split result
> -----------------------------
>
> Key: GROOVY-7786
> URL: https://issues.apache.org/jira/browse/GROOVY-7786
> Project: Groovy
> Issue Type: Bug
> Components: groovy-jdk
> Affects Versions: 2.4.6
> Environment: Windows
> Reporter: Christian Lipp
> Priority: Minor
>
> The following code
> def input = '[ant, asciidoctorj, ceylon, crash, gaiden]'
> def list = input.split(', ')
> println list.class.canonicalName // java.lang.String[]
> list.removeElement('crash')
> leads to an `MissingMethodException: No signature of method: [Ljava.lang.String;.removeElement() is applicable for argument types: (java.lang.String) values: [crash]`
> But when using
> def input = '[ant, asciidoctorj, ceylon, crash, gaiden]'
> List<String> list = input.split(', ')
> println list.class.canonicalName // java.util.ArrayList
> list.removeElement('crash')
> everything works. This is not intuitive, I would expect my first code to work (i used it within a fluent call chain). However I know that I can use the minus call.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)