diff --git a/serialization/src/main/kotlin/net/corda/serialization/internal/amqp/EvolutionSerializer.kt b/serialization/src/main/kotlin/net/corda/serialization/internal/amqp/EvolutionSerializer.kt index 4604af4505..700a3b51bb 100644 --- a/serialization/src/main/kotlin/net/corda/serialization/internal/amqp/EvolutionSerializer.kt +++ b/serialization/src/main/kotlin/net/corda/serialization/internal/amqp/EvolutionSerializer.kt @@ -116,7 +116,6 @@ abstract class EvolutionSerializer( factory: SerializerFactory, constructor: KFunction, readersAsSerialized: Map): AMQPSerializer { - val constructorArgs = arrayOfNulls(constructor.parameters.size) // Java doesn't care about nullability unless it's a primitive in which // case it can't be referenced. Unfortunately whilst Kotlin does apply @@ -144,7 +143,7 @@ abstract class EvolutionSerializer( } } } - return EvolutionSerializerViaConstructor(new.type, factory, readersAsSerialized, constructor, constructorArgs) + return EvolutionSerializerViaConstructor(new.type, factory, readersAsSerialized, constructor) } private fun makeWithSetters( @@ -210,8 +209,7 @@ class EvolutionSerializerViaConstructor( clazz: Type, factory: SerializerFactory, oldReaders: Map, - kotlinConstructor: KFunction, - private val constructorArgs: Array) : EvolutionSerializer(clazz, factory, oldReaders, kotlinConstructor) { + kotlinConstructor: KFunction) : EvolutionSerializer(clazz, factory, oldReaders, kotlinConstructor) { /** * Unlike a normal [readObject] call where we simply apply the parameter deserialisers * to the object list of values we need to map that list, which is ordered per the @@ -226,6 +224,7 @@ class EvolutionSerializerViaConstructor( ): Any { if (obj !is List<*>) throw NotSerializableException("Body of described type is unexpected $obj") + val constructorArgs : Array = arrayOfNulls(kotlinConstructor.parameters.size) // *must* read all the parameters in the order they were serialized oldReaders.values.zip(obj).map { it.first.readProperty(it.second, schemas, input, constructorArgs, context) }