You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Ian (Jira)" <ji...@apache.org> on 2020/05/22 11:55:00 UTC
[jira] [Created] (GROOVY-9570) Class-Level Closure Definition With
Generics Fails TypeChecked
Ian created GROOVY-9570:
---------------------------
Summary: Class-Level Closure Definition With Generics Fails TypeChecked
Key: GROOVY-9570
URL: https://issues.apache.org/jira/browse/GROOVY-9570
Project: Groovy
Issue Type: Bug
Affects Versions: 3.0.3, 3.0.0, 2.5.5
Reporter: Ian
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:
filename.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.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)