groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Sun (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (GROOVY-8138) Compile static to support streams
Date Mon, 07 May 2018 01:49:00 GMT

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

Daniel Sun updated GROOVY-8138:
-------------------------------
    Fix Version/s: 2.6.0-alpha-3

> Compile static to support streams
> ---------------------------------
>
>                 Key: GROOVY-8138
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8138
>             Project: Groovy
>          Issue Type: New Feature
>          Components: Static compilation
>    Affects Versions: 2.4.10
>         Environment: Windows 7, JDK 1.8.0_66
>            Reporter: Iurii
>            Assignee: Daniel Sun
>            Priority: Major
>             Fix For: 2.6.0-alpha-3, 3.0.0-alpha-2, 2.5.0-rc-2
>
>
> The following code
> {code}
> import groovy.transform.CompileStatic
> import static java.util.stream.Collectors.toList
> @CompileStatic
> class Test {
>     static void main(String[] args) {
>         List<String> tables = ['a', 'b']
>         println tables.stream().filter { tableName -> tableName.contains('a') }.collect(toList())
>     }
> }
> {code}
> fails with the error:
> Error:(9, 55) Groovyc: [Static type checking] - Cannot find matching method java.lang.Object#contains(java.lang.String).
Please check if the declared type is right and if the method exists.
> But works fine with compile dynamic.
> It would be great if CompileStatic get all required types from the steam (type info should
be there, Java can handle similar code)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message