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 2023/02/10 21:40:00 UTC

[jira] [Closed] (GROOVY-7992) Sort methods that accept a comparator should accept Comparator (fix type checker ability to cope with super in DGM methods)

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

Paul King closed GROOVY-7992.
-----------------------------

> Sort methods that accept a comparator should accept Comparator<? super T> (fix type checker ability to cope with super in DGM methods)
> --------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-7992
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7992
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-jdk
>    Affects Versions: 2.4.7
>            Reporter: Mauro Molinari
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 4.0.7
>
>
> Methods like {{org.codehaus.groovy.runtime.DefaultGroovyMethods.sort(Iterable<T>, boolean, Comparator<T>)}} and all the others alike should be changed to accept a {{Comparator<? super T>}}, otherwise if you use {{@CompileStatic}} you'll get compiler errors as soon as you try to sort an Iterable/Collection using a comparator that accept superclass instances.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)