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

java.lang.VerifyError with nested closures

    XMLWordPrintableJSON

Details

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

    Description

      I'm having problems with multiple nested closures. The code looks like something like this:

      #! /bin/groovysh
      def values = [:]
      def format = ["a":true, "b":false]
      def input = ["a", "ok", "b"]

      format.each () {
      def id = it.key
      if ( it.value )
      input.each () { values.put(id, it) }
      else
      input.each () { values.put(id, it) }
      }

      When the sript run all I get is a VerifyError exception:
      Caught: java.lang.VerifyError: (class: issue_example$_run_closure1, method: doCall signature: (Ljava/lang/Object;)Ljava/lang/Object Accessing value from uninitialized register 5
      at issue_example.run(issue_example.groovy:6)
      at issue_example.main(issue_example.groovy)

      Surprisinly, if I change the else instruction to any non closure sentence, the script runs as expected.

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            runoverdog runoverdog
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: