[
https://issues.apache.org/jira/browse/GROOVY-8029?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dmitry Bobrov updated GROOVY-8029:
----------------------------------
Description:
The following code, when used with {{\@CompileStatic}}, produces {{Groovyc:
[Static type checking] - Cannot call <T,E> java.util.List
<Object>#collectMany(groovy.lang.Closure <java.util.Collection>) with arguments
[groovy.lang.Closure <java.util.List>]}}
{code}
List<String> getStrings(List<Object> l) {
l.collectMany { [it.toString()] } ?: ([] as List<String>)
}
{code}
was:
The following code, when used with {{\@CompileStatic}}, produces {{Groovyc:
[Static type checking] - Cannot call <T,E> java.util.List
<Object>#collectMany(groovy.lang.Closure <java.util.Collection>) with arguments
[groovy.lang.Closure <java.util.List>]}}
{code:groovy}
List<String> getStrings(List<Object> l) {
l.collectMany { [it.toString()] } ?: ([] as List<String>)
}
{code}
> Static compilation fails when using collectMany and elvis operator
> ------------------------------------------------------------------
>
> Key: GROOVY-8029
> URL: https://issues.apache.org/jira/browse/GROOVY-8029
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Affects Versions: 2.4.7
> Reporter: Dmitry Bobrov
> Priority: Minor
>
> The following code, when used with {{\@CompileStatic}}, produces {{Groovyc:
> [Static type checking] - Cannot call <T,E> java.util.List
> <Object>#collectMany(groovy.lang.Closure <java.util.Collection>) with
> arguments [groovy.lang.Closure <java.util.List>]}}
> {code}
> List<String> getStrings(List<Object> l) {
> l.collectMany { [it.toString()] } ?: ([] as List<String>)
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)