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/02/10 18:30:00 UTC

[jira] [Assigned] (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 reassigned GROOVY-9935:
-----------------------------------

    Assignee: Eric Milles

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