Daniel Sun created GROOVY-10035:
-----------------------------------
Summary: CLONE - Compiler writes extra cast for Type[] to Object[]
Key: GROOVY-10035
URL: https://issues.apache.org/jira/browse/GROOVY-10035
Project: Groovy
Issue Type: Improvement
Components: bytecode
Reporter: Eric Milles
Assignee: Eric Milles
Consider the following:
{code:groovy}
['x'].toArray(new String[0])
{code}
This produces a bytecode sequence that includes a cast from {{String[]}} to
{{Object[]}}. javac for the same code omits the cast.
{code}
9 iconst_0
10 multianewarray java.lang.String[] [44]
14 invokedynamic 0 cast(java.lang.String[]) : java.lang.Object[] [58]
19 invokeinterface java.util.Collection.toArray(java.lang.Object[]) :
java.lang.Object[] [64] [nargs: 2]
{code}
Note: {{multianewarray}} vs {{anewarray}} was fixed by GROOVY-10031
--
This message was sent by Atlassian Jira
(v8.3.4#803005)