groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cédric Champeau (JIRA) <j...@apache.org>
Subject [jira] [Commented] (GROOVY-5734) Ternary operator returning null fails with static type checking
Date Thu, 16 Jul 2015 20:44:04 GMT

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

Cédric Champeau commented on GROOVY-5734:
-----------------------------------------

I'm not sure it is the same issue. Would you mind creating a new ticket? Does it happen if
Foo is not written in Java ?

> Ternary operator returning null fails with static type checking
> ---------------------------------------------------------------
>
>                 Key: GROOVY-5734
>                 URL: https://issues.apache.org/jira/browse/GROOVY-5734
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation
>    Affects Versions: 2.0.4
>            Reporter: Rodolfo Cruz
>            Assignee: Cédric Champeau
>             Fix For: 2.0.6
>
>         Attachments: someMethod.groovy
>
>
> If I define:
> {code}
> @groovy.transform.CompileStatic
> Integer someMethod() {
>     (false) ? null : 8
> }
> {code}
> this throws the following error:
> [Static type checking] - Cannot return value of type java.lang.Object on method returning
type java.lang.Integer -> java.lang.Integer 



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

Mime
View raw message