Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Duplicate
-
3.0.15
-
None
-
None
Description
Assigning a List to an Array of the same type does not compile.
This class:
package example import groovy.transform.CompileStatic @CompileStatic class AssignListToArray { void doStuff(String[] data) { data = data.collect { it } } }
Results in this compilation error:
src/main/groovy/example/AssignListToArray.groovy: 8: [Static type checking] - Cannot assign value of type java.util.List <java.lang.String> to variable of type java.lang.String[] @ line 8, column 10. data = data.collect { it }
This class compiles in 2.4.21, 2.5.21, and 3.0.14.
Attachments
Issue Links
- is related to
-
GROOVY-7506 Cannot assign value of type java.util.List<java.lang.String> to variable of type java.lang.String[]
- Closed
-
GROOVY-8983 Cannot assign Collection to Array
- Closed
-
GROOVY-8984 Can assign Collection with super wildcard to Array
- Closed