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

array or collection coercion of non-collection iterable produces single-element result

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.0.0, 4.0.0, 5.0.0-alpha-8
    • 3.0.22, 5.0.0-alpha-9, 4.0.22
    • groovy-jdk
    • None

    Description

      Consider the following:

      @Grab('org.apache.commons:commons-collections4:4.4')
      import org.apache.commons.collections4.FluentIterable
      
      def iterable = FluentIterable.of(['foo','bar','baz'])
      def array = iterable as String[]
      print array.length
      

      This script prints "1". We are expecting an array of 3 strings.

      GROOVY-7867, GROOVY-10028, GROOVY-10223

      Attachments

        Activity

          People

            emilles Eric Milles
            emilles Eric Milles
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: