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

Paul King closed GROOVY-8907.
-----------------------------

> StringGroovyMethods.findAll(String, Pattern, Closure) and 
> StringGroovyMethods.findAll(CharSequence, Pattern, Closure) is with 
> @ClosureParams incorrect
> ------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-8907
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8907
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-runtime
>    Affects Versions: 3.0.0-alpha-4, 2.5.6
>            Reporter: Henrique Mota
>            Assignee: Paul King
>            Priority: Minor
>             Fix For: 3.0.0-beta-1, 2.5.7
>
>         Attachments: image.png
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> StringGroovyMethods.find(arg1, arg2, Closure) and  
> StringGroovyMethods.findAll(arg1, arg2, Closure) is with 
> @ClosureParams(value=SimpleType.class, options="java.lang.String[]") but the 
> Closure receive a instance of List<String> from 
> DefaultGroovyMethods.collect(matcher, closure), this cause a Exception
> {code:java}
> Caught: java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to 
> java.util.List
> java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to 
> java.util.List
> at CLass.m(brasileiro.groovy:7)
> at CLass$m.call(Unknown Source)
> at brasileiro.run(brasileiro.groovy:13)
> {code}
> Exemple:
> {code:java}
> import groovy.transform.CompileStatic
> @CompileStatic
> class CLass {
>     List m(){
>         String string = 'ABCD'
>         //ClassCastException here
>         return string.findAll(/(A)(B)(C)/) { String[] group->
>              return group[2]
>         }
>     }
> }
> new CLass().m(){code}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to