Issue Details (XML | Word | Printable)

Key: GROOVY-1917
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Jochen Theodorou
Reporter: Martin C. Martin
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
groovy

VerifyError when using double instead of Double

Created: 27/May/07 06:45 PM   Updated: 24/Jun/07 05:36 PM
Component/s: None
Affects Version/s: 1.1-beta-1
Fix Version/s: 1.1-beta-2

Time Tracking:
Not Specified

Environment: Windows XP, Java 1.6.0_02, Groovy 1.1-BETA-2-SNAPSHOT

Testcase included: yes


 Description  « Hide
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.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Jochen Theodorou added a comment - 24/Jun/07 05:36 PM
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