We're updating the issue view to help you get more done. 

ClassCarpenter fails when superclass has double-size primitive field (e.g. long, double)

Description

The following test fails, because the `ClassCarpenter` incorrectly calculates the stack size of fields if there are double-size primitive fields (e.g. long or double) in a superclass constructor:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 @Test fun `superclasses with double size constructor parameters`() { val schema1 = ClassSchema( "gen.A", mapOf("a" to NonNullableField(Long::class.javaPrimitiveType!!))) val schema2 = ClassSchema( "gen.B", mapOf("b" to NonNullableField(String::class.java)), schema1) val clazz = cc.build(schema2) val i = clazz.constructors[0].newInstance(1L, "xb") as SimpleFieldAccess assertEquals(1L, i["a"]) assertEquals("xb", i["b"]) assertEquals("B{a=1, b=xb}", i.toString()) }

The fault is in ClassWriter.generateClassConstructor, and the solution is to sum the sizes of the fields in the superclass constructor and make sure this value is used to set the initial stack slot correctly for the parameters.

Status

Assignee

Dominic.Fox@r3.com

Reporter

Dominic.Fox@r3.com

Labels

None

Affected OS

None

Severity

Medium

Target Version/s

Corda Enterprise 3.2
Corda 3.3

Feature Team

Corda Core

Fix versions

Affects versions

Corda 3.2

Priority

Medium