Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.5.5, 3.0.0, 3.0.3
-
None
-
None
Description
import groovy.transform.TypeChecked @TypeChecked abstract class A<T extends List>{ Collection<T> testQueue Closure c = { testQueue.each{T item-> println item } } //def foo() { // testQueue.each{T item-> // println item // } //} } new A<LinkedList>(){}
Put this in filename.groovy and call "groovy filename.groovy" and I get
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: /home/ianl/closureGeneric.groovy: 9: Expected parameter of type java.lang.Object but got T @ line 7, column 24. testQueue.each{T item-> ^ 1 error
Yet, uncomment the method foo() and there's no error there. or put the closure definition into the method and there's no error.