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

Type checker doesn't find a method defined in Arrays

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0-rc-3
    • 2.0-rc-4
    • None
    • None

    Description

      The following code produces a type checking error:

      import groovy.transform.TypeChecked
      import java.util.Arrays
      
      @TypeChecked
      class ArrayCopying {
      
          public static void main(String[] args) {
              def acopy = Arrays.copyOf(args, 1)
          }
      
      }
      

      Error:
      {{Cannot find matching
      method java.lang.Class#copyOf([Ljava.lang.String;, int)}}

      The type checker doesn't seem to be aware that copyOf is defined on Arrays.

      Attachments

        Activity

          People

            melix Cédric Champeau
            melix Cédric Champeau
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: