Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-8983

Cannot assign Collection to Array

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.5.6
    • Fix Version/s: 4.0.0-alpha-3
    • Component/s: Static Type Checker
    • Labels:
      None

      Description

      Collection<? extends Runnable> foo() {}
      
      @groovy.transform.CompileStatic
      def usage() {
        Runnable[] ar = foo() // OK as expected
      }
      
      @groovy.transform.CompileStatic
      def usage(Collection<? extends Runnable> cr) {
        Runnable[] ar = cr // [Static type checking] - Cannot assign value of type java.util.Collection <? extends java.lang.Runnable> to variable of type java.lang.Runnable[]
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                emilles Eric Milles
                Reporter:
                daniilo Daniil Ovchinnikov
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h