[ 
https://issues.apache.org/jira/browse/GROOVY-10029?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Milles updated GROOVY-10029:
---------------------------------
    Description: 
Consider the following:
{code:groovy}
@groovy.transform.CompileStatic
void test() {
  def list = [1, 2, 3, 4]
  Number[] array = list
  println array
}
test()
{code}

Groovy supports the implicit conversion "array = list" under STC/SC as of 
GROOVY-10002 and GROOVY-8983.  Can the static compilation mode replace the call 
to {{DefaultTypeTransformation#castToType}} with a direct call to the 
collection's {{toArray()}} or {{toArray(T[])}}?

  was:
Consider the following:
{code:groovy}
@groovy.transform.CompileStatic
void test() {
  def list = [1, 2, 3, 4]
  Number[] array = list
  println array
}
test()
{code}

Groovy supports the implicit conversion "array = list" under STC/SC as of 
GROOVY-10002 and GROOVY-8983.  Can the static compilation mode replace the call 
to {{ScriptBytecodeAdapter#castToType}} with a direct call to the collection's 
{{toArray()}} or {{toArray(T[])}}?


> SC: produce direct method call for assignment of collection to array
> --------------------------------------------------------------------
>
>                 Key: GROOVY-10029
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10029
>             Project: Groovy
>          Issue Type: Improvement
>          Components: Static compilation
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Minor
>
> Consider the following:
> {code:groovy}
> @groovy.transform.CompileStatic
> void test() {
>   def list = [1, 2, 3, 4]
>   Number[] array = list
>   println array
> }
> test()
> {code}
> Groovy supports the implicit conversion "array = list" under STC/SC as of 
> GROOVY-10002 and GROOVY-8983.  Can the static compilation mode replace the 
> call to {{DefaultTypeTransformation#castToType}} with a direct call to the 
> collection's {{toArray()}} or {{toArray(T[])}}?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to