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

java.lang.VerifyError with nested closures

    XMLWordPrintableJSON

Details

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

    Description

      Following groovy code throws java.lang.Verify Error. If I change the second .each to a for loop or remove the if statement with .any, no error is thrown. This code was working with a JSR-05 snapshot from around JAN-30.

      def census = []
      census << [id:1, longTermClassId:1]
      census << [id:4, longTermClassId:2]
      def planClassMap = [1:[1], 2:[2]]
      census.each { member->
      planClassMap.each {pdId, classList -> /
      if (classList.isEmpty() || classList.any

      {it == member.longTermClassId}

      )

      { classList << member }

      }
      }

      ERROR:
      Caught: java.lang.VerifyError: (class: LangVerifyError$_run_closure1_closure2, method: doCall signature: (Ljava/lang/Object;Ljava/la
      ng/Object;)Ljava/lang/Object Accessing value from uninitialized register 4
      at LangVerifyError$_run_closure1.doCall(LangVerifyError.groovy:6)
      at LangVerifyError.run(LangVerifyError.groovy:5)
      at LangVerifyError.main(LangVerifyError.groovy)

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            jshickey Scott Hickey
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: