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

Closure disallows for static dispatch of call(Object[])

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.0.0-alpha-1
    • None
    • None
    • None

    Description

      I have something like this:

      @groovy.transform.CompileStatic
      class A {
          Closure x
      
          def call(...args) {
              x.call((Object[]) args)
          }
      
          static main(w) {
              def a = new A(x: { ...args -> println(args[0].toString()) })
              a(1, 2, 3)
          }
      }
      

      And the output is [1, 2, 3].

      If I remove CompileStatic the output is 1.

      I think the culprit is the call(Object) method in Closure

      Attachments

        Activity

          People

            Unassigned Unassigned
            deathlord death lord
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: