Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Won't Fix
-
2.4.4, 2.4.5
-
None
-
None
-
JDK 1.8.0_51/win32
Description
@groovy.transform.CompileStatic void bug() { int a = [1,2,3].sum() }
The code above works correctly with CompileDynamic, but CompileStatic will produce the following error:
[Static type checking] - Cannot assign value of type java.lang.Object to variable of type int
Seems to be a problem of DefaultGroovyMethods.sum(Iterable).
I think it just need to be changed from
public static Object sum(Iterable self)
to
public static <T> T sum(Iterable<T> self)