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

You cannot reference a closure from within itself without def'ing it first and then assigning it

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 1.0-JSR-6
    • 1.1-rc-3
    • None
    • None

    Description

      Doesn't work:

      def c =

      { c() }
      c()

      Caught: groovy.lang.MissingMethodException: No signature of method script_from_command_line.c() is applicable for argument types: () values: {}
      at script_from_command_line$_run_closure1.doCall(script_from_command_line:1)
      at script_from_command_line$_run_closure1.doCall(script_from_command_line)
      at script_from_command_line.run(script_from_command_line:1)
      at script_from_command_line.main(script_from_command_line)

      Works:

      def c;
      c = { c() }

      c()

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            spullara Sam Pullara
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: