groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cazacu Mihai (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GROOVY-7927) Static type checking
Date Sat, 03 Sep 2016 20:49:20 GMT

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

Cazacu Mihai commented on GROOVY-7927:
--------------------------------------

@[~blackdrag]: Using the latest version of groovy (built from [source|https://github.com/apache/groovy.git])
I have another static compilation issue (which doesn't exist in <= 2.4.7). The reproducer
can be found [here|https://github.com/cazacugmihai/groovy_static_bug]. Please clone the project
and try to run _GroovyTest_ class. 

Do you consider that I should open another issue for this one? Thanks!

> Static type checking
> --------------------
>
>                 Key: GROOVY-7927
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7927
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation
>    Affects Versions: 2.4.7
>            Reporter: Cazacu Mihai
>            Assignee: Jochen Theodorou
>             Fix For: 2.4.8
>
>
> I have a problem running this code: 
>   
> {code:title=Test.groovy|borderStyle=solid}
> import groovy.transform.CompileStatic 
> import java.util.function.Function 
>   
> @CompileStatic 
> class Test { 
>         static void main(String[] args) { 
>                // this code fails 
>                 Function<Integer, Integer> fct = { Integer n -> 
>                         -n 
>                 } 
>   
>                 // this one works but it is too verbose 
>                 // Function<Integer, Integer> fct = ({ Integer n -> 
>                 // -n 
>                 // } as Function<Integer, Integer>) 
>   
>                 println fct.apply(10) 
>         } 
> } 
> {code}
> Error: 
> {quote}
> Test.groovy: 9: [Static type checking] - Incompatible generic argument types. Cannot
assign java.util.function.Function <java.lang.Integer, groovy.lang.Closure> to: java.util.function.Function
<Integer, Integer>
>  @ line 9, column 36. 
>    	Function<Integer, Integer> fct = { Integer n -> 
>                                       ^ 
> 1 error 
> {quote}



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

Mime
View raw message