You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniel Sun (JIRA)" <ji...@apache.org> on 2018/05/07 01:50:00 UTC

[jira] [Comment Edited] (GROOVY-8138) Compile static to support streams

    [ https://issues.apache.org/jira/browse/GROOVY-8138?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16465333#comment-16465333 ] 

Daniel Sun edited comment on GROOVY-8138 at 5/7/18 1:49 AM:
------------------------------------------------------------

The issue has been fixed: https://github.com/apache/groovy/commit/91f44d85916861e762be5f4aa87b8f4f27e948d3


was (Author: daniel_sun):
The issue has been fixed.

> 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)