You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2021/03/03 15:59:00 UTC

[jira] [Updated] (GROOVY-9935) int reference seems to not use its wrapper class

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

Eric Milles updated GROOVY-9935:
--------------------------------
    Fix Version/s: 3.0.8

> int reference seems to not use its wrapper class
> ------------------------------------------------
>
>                 Key: GROOVY-9935
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9935
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation, Static Type Checker
>    Affects Versions: 3.0.7
>            Reporter: Stefanos Chaliasos
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 3.0.8, 4.0.0-alpha-3
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> I have the following Groovy program
>  
> {code:groovy}
> @groovy.transform.TypeChecked
> class Foo {
>   static Number foo() {
>     def i = 10  // If I use: `Integer i = 10` it works
>     return i
>   }
> }
> {code}
> h2. Actual Behavior
> The program does not compile, and I get the following error.
> {code:java}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> Test.groovy: 5: [Static type checking] - Cannot return value of type int on method returning type java.lang.Number
>  @ line 5, column 12.
>        return i
>               ^
> 1 error
> {code}
> h2. Expected Behavior
> Compile successfully.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)