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

Provide tail/init/head/first/last for primitive arrays

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 5.0.0-alpha-1
    • groovy-jdk
    • None

    Description

      Consider the following:

      @groovy.transform.TypeChecked
      void test(int[] ints) {
        ints.eachWithIndex { value, index ->
          println "$index: ${value.doubleValue()}"
        }
      }
      test(0,1,2,3,4,5)
      

      Compiler reports "[Static type checking] - Cannot find matching method java.lang.Object#doubleValue()"

      eachWithIndex is only provided for reference types, so "value" is seen as Object by the type checker.

      Attachments

        Issue Links

          Activity

            People

              paulk Paul King
              paulk Paul King
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: