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 2026/02/08 01:09:00 UTC

[jira] [Created] (GROOVY-11856) Compiler writes extra cast for method call on list expression

Eric Milles created GROOVY-11856:
------------------------------------

             Summary: Compiler writes extra cast for method call on list expression
                 Key: GROOVY-11856
                 URL: https://issues.apache.org/jira/browse/GROOVY-11856
             Project: Groovy
          Issue Type: Bug
            Reporter: Eric Milles
            Assignee: Eric Milles


Consider the following:
{code:groovy}
@CompileStatic
def test() {
  ["x"].toArray(new String[0])
}
{code}

After {{INVOKESTATIC org/codehaus/groovy/runtime/ScriptBytecodeAdapter.createList}} the compiler writes an {{INVOKEDYNAMIC cast}} from {{List}} to {{ArrayList}}.  STC knows the type of list is already an {{ArrayList}}.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)