Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.1-beta-1
-
Fix Version/s: 1.1-beta-2
-
Component/s: None
-
Labels:None
-
Environment:Windows XP, Java 1.6.0_02, Groovy 1.1-BETA-2-SNAPSHOT
-
Testcase included:yes
-
Number of attachments :
Description
The following unit test:
class VEBug extends GroovyTestCase {
static void caller(double start, Integer numIter) {
numIter.times {
assertEquals(20d, VEBug.foo(start))
}
}
static double foo(double x) { return x*10 }
void testCaller() {
caller(2.0d, 5)
}
}
fails with "Caught: java.lang.VerifyError: (class: VEBug, method: caller signature: (DLjava/lang/Integer;)V) Register 1 contains wrong type"
If you change the first parameter of caller to be type Double instead of double, it works fine.
yes, there was a small bug when a double variable is used in a closure, because a double (and long) variable requires 2 register places in java, but making a reference out of it (for the closure) creates an object (the boxed value) which takes only one entry. The compiler now falsely used only one register entry instead of the two for the double. But two are require or else the next parameter will be used wrong.
Now fixed