Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
Consider the following:
@groovy.transform.TypeChecked void test() { List<String> a = [] // okay Set<String> b = [] // okay Deque<String> c = [] // GroovyCastException at runtime Deque<String> d = [1,2,3] // error for unknown constructor (interfaces don't have them) and error for incompatible generics ArrayDeque<String> e = [123] // ArrayDeque(int numElements); error for incompatible generics (bad) Set<String> f = ['foo', 'bar', 'foo'] // error for unknown constructor (castToType would handle this at runtime if allowed) and error for incompatible generic types (wrong) }