https://kotlinlang.org logo
n

neworldlt

03/15/2018, 7:16 PM
I created a solution of this problem: https://github.com/Kotlin/kotlinx.serialization/pull/99
s

sandwwraith

03/16/2018, 6:42 PM
Thank you for your PR! I’ll review it thoroughly later; from a first look it should work, but have you tested it with containers with more than one generic parameter? I think compiler will just add more arguments to signature, as far as I remember
So it’s possibly the plugin should be also reworked to pass e.g. array of serializers for generic classes
n

neworldlt

03/17/2018, 8:47 AM
No, didn’t tested with >1 generics, only fixed my problem. I just want to know if is it a good approach.
array of serializers for generic classes
would be great and easy to implement.
I will try implement multiple generics support with current plugin compliter plugin.
vararg
doesn’t work with constructors. array or list of serializers for generics would be good
Unfortunatelly this doesn’t work with JS. JS generates ContextSerializers without inner serializers:
Copy code
output.writeSerializableElementValue_k4al2t$(this.serialClassDesc, 0, new ContextSerializer(Kotlin.getKClass(CustomContainerSerializersTest$Container)), obj.container);
    output.writeSerializableElementValue_k4al2t$(this.serialClassDesc, 1, new ContextSerializer(Kotlin.getKClass(CustomContainerSerializersTest$KeyValue)), obj.keyValue);