REVIEW COMMENTS

Remove the recursive call from directly inside the string builder
This commit is contained in:
Katelyn Baker 2017-07-25 16:50:58 +01:00
parent b8ae03410d
commit 96496fdeb5

View File

@ -23,8 +23,13 @@ open class ArraySerializer(override val type: Type, factory: SerializerFactory)
// We *need* to retain knowledge for AMQP deserialisation weather that lowest primitive
// was boxed or unboxed so just infer it recursively
private fun calcTypeName(type: Type) : String =
if (type.componentType().isArray()) "${calcTypeName(type.componentType())}[]"
else "${type.componentType().typeName}${if (type.asClass()!!.componentType.isPrimitive) "[p]" else "[]"}"
if (type.componentType().isArray()) {
val typeName = calcTypeName(type.componentType()); "$typeName[]"
}
else {
val arrayType = if (type.asClass()!!.componentType.isPrimitive) "[p]" else "[]"
"${type.componentType().typeName}$arrayType"
}
override val typeDescriptor by lazy { "$DESCRIPTOR_DOMAIN:${fingerprintForType(type, factory)}" }
internal val elementType: Type by lazy { type.componentType() }