[jira] [Created] (GROOVY-8984) Can assign Collection with super wildcard to Array

2019-02-08 Thread Daniil Ovchinnikov (JIRA)
Daniil Ovchinnikov created GROOVY-8984:
--

 Summary: Can assign Collection with super wildcard to Array
 Key: GROOVY-8984
 URL: https://issues.apache.org/jira/browse/GROOVY-8984
 Project: Groovy
  Issue Type: Bug
  Components: Static Type Checker
Affects Versions: 2.5.6
Reporter: Daniil Ovchinnikov


{code:java}
Collection foo() {[new Object()]}

@groovy.transform.CompileStatic
def usage() {
  Runnable[] ar = foo() // here
  ar
}

println usage()
{code}
Expected: compilation should fail
 Actual: compilation completes and execution fails with {{Cannot cast object 
'java.lang.Object@65e98b1c' with class 'java.lang.Object' to class 
'java.lang.Runnable'}}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Created] (GROOVY-8983) Cannot assign Collection to Array

2019-02-08 Thread Daniil Ovchinnikov (JIRA)
Daniil Ovchinnikov created GROOVY-8983:
--

 Summary: Cannot assign Collection to Array
 Key: GROOVY-8983
 URL: https://issues.apache.org/jira/browse/GROOVY-8983
 Project: Groovy
  Issue Type: Bug
  Components: Static Type Checker
Affects Versions: 2.5.6
Reporter: Daniil Ovchinnikov


{code:java}
Collection foo() {}

@groovy.transform.CompileStatic
def usage() {
  Runnable[] ar = foo() // OK as expected
}

@groovy.transform.CompileStatic
def usage(Collection cr) {
  Runnable[] ar = cr // [Static type checking] - Cannot assign value of type 
java.util.Collection  to variable of type 
java.lang.Runnable[]
}
{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)