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

Pascal Schumacher updated GROOVY-7061:
--------------------------------------
    Affects Version/s:     (was: 2.4.0-rc-1)
                       2.4.5

> Type inference not working for Collections.sort()
> -------------------------------------------------
>
>                 Key: GROOVY-7061
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7061
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>    Affects Versions: 2.3.6, 2.4.5
>            Reporter: Peter Ledbrook
>            Assignee: Cédric Champeau
>
> In this example:
> {code}
> import groovy.transform.TypeChecked
> doIt()
> @TypeChecked
> void doIt() {
>     List<Integer> nums = [1, 2, 3, -2, -5, 6]
> //    nums.sort { a, b -> a.abs() <=> b.abs() }
>     Collections.sort(nums, { a, b -> a.abs() <=> b.abs() })
> }
> {code}
> the type checking fails on the closure arguments (no method {{abs()}} on type 
> {{Object}}). Interestingly, it works fine for the line that's commented out.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to