Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.0-JSR-6
-
Fix Version/s: 1.1-beta-1
-
Component/s: None
-
Labels:None
-
Number of attachments :
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.
adding
{ and }to the if-else fixes the problem.. strange