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

println in closure has problem

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.0-beta-8
    • 1.0-JSR-1
    • None
    • None
    • Debian GNU/Linux testing with Sun JDK1.5

    Description

      The script:

      #!/usr/bin/env groovy
      println()

      works fine. However the script:

      #! /usr/bin/env groovy

      testList = [ 1, 2, 3, 4, 5 ]

      testList.each { test |
      println()
      }

      fails with the message:

      Caught: groovy.lang.GroovyRuntimeException: Could not find which method to invoke from this list: [org.codehaus.groovy.runtime.NewInstanceMetaMethod@94884d[name: println params: [class java.lang.Object, class java.lang.Object] returns: void owner: class org.codehaus.groovy.runtime.DefaultGroovyMethods], org.codehaus.groovy.runtime.NewInstanceMetaMethod@84da23[name: println params: [class java.lang.Object, class java.io.PrintWriter] returns: void owner: class org.codehaus.groovy.runtime.DefaultGroovyMethods]] for arguments: []
      at trial$_run_closure1.doCall(/home/users/russel/Progs/Groovy/BugTests/./trial.groovy:6)
      at trial.run(/home/users/russel/Progs/Groovy/BugTests/./trial.groovy:5)
      at trial.main(/home/users/russel/Progs/Groovy/BugTests/./trial.groovy)

      using println("") sort of cures the problem.

      Attachments

        1. PrintlnFromClosure.patch
          1 kB
          Kim, Pilho

        Activity

          People

            blackdrag Jochen Theodorou
            russel Dr. Russel Winder
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: