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

Default argument is not used

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.5.6
    • 1.6.1, 1.5.8, 1.7-beta-1
    • None
    • None

    Description

      The following script:

      def meth(Closure cl = null) {
        println '1'
        meth([:], cl)
      }
      
      def meth(Map args = [:], Closure cl = null) {
          println '2'
          println args
      }
      
      meth()
      

      prints

      2
      null
      

      If I remove the first method it prints:

      2
      [:]
      

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            hans_d Hans Dockter
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: