[
https://issues.apache.org/jira/browse/GROOVY-8560?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Paul King closed GROOVY-8560.
-----------------------------
> Spread operator type conversion error
> -------------------------------------
>
> Key: GROOVY-8560
> URL: https://issues.apache.org/jira/browse/GROOVY-8560
> Project: Groovy
> Issue Type: Bug
> Components: groovy-runtime
> Affects Versions: 2.4.15
> Reporter: Petteri Johansson
> Assignee: Eric Milles
> Priority: Minor
> Fix For: 5.0.0-beta-1, 3.0.25, 4.0.27
>
>
> Line 6 with spread operator throws runtime typecast exception:
> {code:java}
> class Test {
> def test() {
> byte [] b = [0, 0] as byte[]
> Object [] oa = [b] as Object []
> method( oa[0] )
> method( *oa ) //Does not work
> }
> def method(byte[] bytes) {}
> }
> new Test().test()
> {code}
>
> Result:
> Caught: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot
> cast object '[0, 0]' with class 'java.util.ArrayList' to class
> 'java.lang.Byte'
> org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast
> object '[0, 0]' with class 'java.util.ArrayList' to class 'java.lang.Byte'
> at Test.test(test.groovy:7)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)