Stefanos Chaliasos created GROOVY-9935:
------------------------------------------

             Summary: 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


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)

Reply via email to