Improve desensitizer: generate .serializer() for .toByteArray

This commit is contained in:
Him188 2021-09-30 22:37:11 +01:00
parent a2e602adfd
commit 6b63c323e5

View File

@ -195,9 +195,14 @@ private class DesensitizationVisitor(
val result = instance.cast<NestedStructureDesensitizer<ProtocolStruct, ProtocolStruct>>()
.deserialize(desc.origin as ProtocolStruct, value.origin as ByteArray)
?: desc.origin
val generate = ConstructorCallCodegenFacade.generateAndDesensitize(result)
PlainValueDesc(desc, "$generate.toByteArray()", value.origin)
PlainValueDesc(
desc,
"$generate.toByteArray(${result::class.qualifiedName}.serializer())",
value.origin
)
} else value
}
}