n

    neworldlt

    4 years ago
    I created a solution of this problem: https://github.com/Kotlin/kotlinx.serialization/pull/99
    s

    sandwwraith

    4 years ago
    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

    4 years ago
    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:
    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);