[ https://issues.apache.org/jira/browse/GROOVY-7179?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King closed GROOVY-7179. ----------------------------- > Type inference fails on the return value of inject() > ---------------------------------------------------- > > Key: GROOVY-7179 > URL: https://issues.apache.org/jira/browse/GROOVY-7179 > Project: Groovy > Issue Type: Bug > Components: Static compilation > Affects Versions: 2.3.7, 2.4.1 > Reporter: Yu Kobayashi > Priority: Major > > Type inference fails on the return value of inject(). > {code} > @groovy.transform.CompileStatic > List<Integer> test() { > (2..3).inject([1], { list, i -> list << i }) > } > println test() > {code} > Error message: > {code} > org.codehaus.groovy.control.MultipleCompilationErrorsException: startup > failed: > C:\Users\Yu\Desktop\test.groovy: 3: [Static type checking] - Cannot return > value of type java.lang.Object on method returning type java.util.List > <Integer> @ line 3, column 5. > (2..3).inject([1], { list, i -> list + i }) > ^ > {code} > By the way, IntelliJ IDEA 14 fails on inferencing closure argument types, and > success on the return type for this code. -- This message was sent by Atlassian Jira (v8.20.10#820010)