Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
2.4.15
-
None
-
None
Description
Line 6 with spread operator throws runtime typecast exception:
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()
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)
Attachments
Issue Links
- relates to
-
GROOVY-11182 Primitive array Varargs Java incompatibility
- Open