Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-55883

vararg closure does not work in pipeline script

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: groovy-plugin
    • Labels:
    • Environment:
      Jenkins 2.150.1
      Pipeline: Groovy plugin 2.62
    • Similar Issues:

      Description

      Defining closure with vararg does not work in a pipeline script:

      def fn = {String... args -> echo args.toString()}
      fn('one', 'two', 'three')
      
      Output:
      one
      

      Only workaround I can find is to not use closure:

      def fn(String... args){echo args.toString()}
      fn('one', 'two', 'three')
      
      Output:
      [one, two, three]
      

        Attachments

          Activity

          There are no comments yet on this issue.

            People

            Assignee:
            vjuranek vjuranek
            Reporter:
            shangdi Di Shang
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: