Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
Description
Consider the following:
['x'].toArray(new String[0])
This produces a bytecode sequence that includes a cast from String[] to Object[]. javac for the same code omits the cast.
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]
Note: multianewarray vs anewarray was fixed by GROOVY-10031
Attachments
Issue Links
- is cloned by
-
GROOVY-10035 Eliminate redundant type cast
- Closed