You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Cédric Champeau (JIRA)" <ji...@apache.org> on 2015/07/16 22:38:04 UTC
[jira] [Updated] (GROOVY-5734) Ternary operator returning null
fails with static type checking
[ https://issues.apache.org/jira/browse/GROOVY-5734?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Cédric Champeau updated GROOVY-5734:
------------------------------------
Description:
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
was:
If I define:
@groovy.transform.CompileStatic
Integer someMethod() {
(false) ? null : 8
}
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
> 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)