Skip to content

Commit

Permalink
Fix repeated custom type can't be converted in message patcher (#41)
Browse files Browse the repository at this point in the history
* Fix repeated custom type can't be converted in message patcher

* Make ktlint happy
  • Loading branch information
devkanro authored Jul 6, 2020
1 parent ea62519 commit 4f31749
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ class ValueNode : PatcherNode {
else -> throw IllegalStateException()
}

val propertyType = property.returnType.classifier as? KClass<*>
val propertyType = if (field.label == FieldDescriptorProto.Label.REPEATED) {
property.returnType.arguments.first().type?.classifier as? KClass<*>
} else {
property.returnType.classifier as? KClass<*>
}
if (propertyType != null && propertyType.isSubclassOf(CustomProtoType::class)) {
result = result.map {
val support = (propertyType.companionObjectInstance as CustomProtoTypeSupport<*, Any>)
Expand Down

0 comments on commit 4f31749

Please sign in to comment.