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

closure can't see script method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-beta-5
    • 1.0-JSR-1
    • None
    • None

    Description

      an example from IRC - the inner closure class can't see 'recursiveDelete'

      #!/usr/bin/env groovy
      <bayard> import java.io.File
      <bayard> for (arg in this.args)

      { <bayard> file = new File(arg) <bayard> recursiveDelete(arg) <bayard> }

      <bayard> def recursiveDelete(File file) {
      <bayard> if( file.isDirectory() ) {
      <bayard> file.eachFile

      { recursiveDelete(it) }

      <bayard> }
      <bayard> file.delete()
      <bayard> }

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: