You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2021/04/12 14:03:00 UTC
[jira] [Created] (GROOVY-10034) Compiler writes extra cast for
Type[] to Object[]
Eric Milles created GROOVY-10034:
------------------------------------
Summary: Compiler writes extra cast for Type[] to Object[]
Key: GROOVY-10034
URL: https://issues.apache.org/jira/browse/GROOVY-10034
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)