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

closure called by using the call method handles arrays incorrectly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.1-rc-1, 1.1-rc-2
    • 1.1-rc-3
    • None
    • None

    Description

      simple example:

      def closure = {x -> x}
      def foo = closure.call([1] as Object[])
      assert foo == 1
      

      while closure has one doCall method, that accepts only one argument, it has two call methods, one of them accepts an array and should be selected here. This method then calls doCall with "this.doCall(*args)" which means the doCall method taking one argument should be choosen and the argument to that method is the conten of the array, the value 1. In stead of this ClosureMetaClass has a bug, which let's it call doCall with the array, which means the call is "this.doCall(args)" instead of "this.doCall(*args)". Which is wrong, foo will have the value [1] instead of 1

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            blackdrag Jochen Theodorou
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: