Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.0.7
-
None
Description
I have the following Groovy program
@groovy.transform.TypeChecked class Foo { static Number foo() { def i = 10 // If I use: `Integer i = 10` it works return i } }
Actual Behavior
The program does not compile, and I get the following error.
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
Expected Behavior
Compile successfully.