CORDA-915 - small bug fix

This commit is contained in:
Katelyn Baker 2018-02-05 18:06:07 +00:00
parent ac416690e0
commit f8359a74fd

View File

@ -263,6 +263,7 @@ fun propertiesForSerializationFromSetters(
factory: SerializerFactory): List<PropertyAccessor> { factory: SerializerFactory): List<PropertyAccessor> {
return mutableListOf<PropertyAccessorGetterSetter>().apply { return mutableListOf<PropertyAccessorGetterSetter>().apply {
var idx = 0 var idx = 0
properties.forEach { property -> properties.forEach { property ->
val getter: Method? = property.value.preferredGetter() val getter: Method? = property.value.preferredGetter()
val setter: Method? = property.value.setter val setter: Method? = property.value.setter
@ -276,7 +277,8 @@ fun propertiesForSerializationFromSetters(
val setterType = setter.parameterTypes[0]!! val setterType = setter.parameterTypes[0]!!
if (!(TypeToken.of(property.value.field?.genericType!!).isSupertypeOf(setterType))) { if ((property.value.field != null) &&
(!(TypeToken.of(property.value.field?.genericType!!).isSupertypeOf(setterType)))) {
throw NotSerializableException("Defined setter for parameter ${property.value.field?.name} " + throw NotSerializableException("Defined setter for parameter ${property.value.field?.name} " +
"takes parameter of type $setterType yet underlying type is " + "takes parameter of type $setterType yet underlying type is " +
"${property.value.field?.genericType!!}") "${property.value.field?.genericType!!}")
@ -290,7 +292,7 @@ fun propertiesForSerializationFromSetters(
} }
this += PropertyAccessorGetterSetter( this += PropertyAccessorGetterSetter(
idx++, idx++,
PropertySerializer.make(property.value.field!!.name, PublicPropertyReader(getter), PropertySerializer.make(property.key, PublicPropertyReader(getter),
resolveTypeVariables(getter.genericReturnType, type), factory), resolveTypeVariables(getter.genericReturnType, type), factory),
setter) setter)
} }