You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2020/09/22 13:01:00 UTC

[jira] [Resolved] (GROOVY-9751) STC: error for addAll with collect argument

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

Paul King resolved GROOVY-9751.
-------------------------------
    Fix Version/s: 3.0.6
                   4.0.0-alpha-1
       Resolution: Fixed

> STC: error for addAll with collect argument
> -------------------------------------------
>
>                 Key: GROOVY-9751
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9751
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 3.0.6
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 4.0.0-alpha-1, 3.0.6
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> Follow up from GROOVY-9734 and GROOVY-8961.  New STC error for generics mismatch when pairing {{collect}} with a method pointer:
> {code:groovy}
> interface Service {
>   Number transform(String s)
> }
> @groovy.transform.TypeChecked
> void test(Service service) {
>   Set<Number> numbers = []
>   List<String> strings = ['x','y','z']
>   numbers.addAll(strings.collect(service.&transform)) // Cannot call java.util.Set <Number>#addAll(java.util.Collection <? extends java.lang.Number>) with arguments [java.util.List <? extends E>]
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)