Henrique Mota created GROOVY-8907:
-------------------------------------

             Summary: 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.x, 2.4.x, 2.5.x, 3.0.0-alpha-4, 2.6.0-alpha-5
            Reporter: Henrique Mota
         Attachments: image.png

StringGroovyMethods.findAll(String, Pattern, Closure) and  
StringGroovyMethods.findAll(CharSequence, Pattern, 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->
{code}
 grupo de retorno [2]
{code:java}
        }
    }
}

{code}
 nova classe (). m ()

 



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

Reply via email to