1 /*
2  * Copyright 2017-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3  */
4 
5 package kotlinx.serialization.internal
6 
7 import kotlinx.serialization.*
8 import kotlin.jvm.*
9 import kotlin.native.concurrent.*
10 
11 @JvmField
12 internal val EMPTY_SERIALIZER_ARRAY: Array<KSerializer<*>> = arrayOf()
13 
14 /**
15  * An interface for a [KSerializer] instance generated by the compiler plugin.
16  *
17  * Should not be implemented manually or used directly.
18  */
19 @InternalSerializationApi
20 public interface GeneratedSerializer<T> : KSerializer<T> {
childSerializersnull21     public fun childSerializers(): Array<KSerializer<*>>
22     public fun typeParametersSerializers(): Array<KSerializer<*>> = EMPTY_SERIALIZER_ARRAY
23 }
24 
25 /**
26  * An internal interface used by the compiler plugin for objects that are factories of typed serializers, for example
27  * for auto-generated companion objects for [Serializable] classes with type parameters.
28  *
29  * This interface is used to lookup and create serializers in K/N using `@AssociatedObjectKey`.
30  * Should not be used in any user code. Please use generated `.serializer(kSerializer1, kSerializer2, ...)`
31  * method on a companion or top-level `serializer(KType)` function.
32  */
33 @Deprecated("Inserted into generated code and should not be used directly", level = DeprecationLevel.HIDDEN)
34 public interface SerializerFactory {
35     public fun serializer(vararg typeParamsSerializers: KSerializer<*>): KSerializer<*>
36 }
37