Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moves ValueWithSerializer back into public API #605

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 2 additions & 74 deletions firebase-common-internal/api/android/firebase-common-internal.api
Original file line number Diff line number Diff line change
Expand Up @@ -78,59 +78,9 @@ public final class dev/gitlive/firebase/internal/EncodersKt {
public static final fun encode (Lkotlinx/serialization/SerializationStrategy;Ljava/lang/Object;Z)Ljava/lang/Object;
public static final fun encodeAsObject (Lkotlinx/serialization/SerializationStrategy;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Ldev/gitlive/firebase/internal/EncodedObject;
public static synthetic fun encodeAsObject$default (Lkotlinx/serialization/SerializationStrategy;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ldev/gitlive/firebase/internal/EncodedObject;
public static final fun withSerializer (Ljava/lang/Object;Lkotlinx/serialization/SerializationStrategy;)Ljava/lang/Object;
}

public final class dev/gitlive/firebase/internal/FirebaseClassDecoder : dev/gitlive/firebase/internal/FirebaseCompositeDecoder {
public fun <init> (ILdev/gitlive/firebase/DecodeSettings;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function2;)V
public fun decodeElementIndex (Lkotlinx/serialization/descriptors/SerialDescriptor;)I
public fun decodeSequentially ()Z
}

public class dev/gitlive/firebase/internal/FirebaseCompositeDecoder : kotlinx/serialization/encoding/CompositeDecoder {
public fun <init> (ILdev/gitlive/firebase/DecodeSettings;Lkotlin/jvm/functions/Function2;)V
public fun decodeBooleanElement (Lkotlinx/serialization/descriptors/SerialDescriptor;I)Z
public fun decodeByteElement (Lkotlinx/serialization/descriptors/SerialDescriptor;I)B
public fun decodeCharElement (Lkotlinx/serialization/descriptors/SerialDescriptor;I)C
public fun decodeCollectionSize (Lkotlinx/serialization/descriptors/SerialDescriptor;)I
public fun decodeDoubleElement (Lkotlinx/serialization/descriptors/SerialDescriptor;I)D
public fun decodeElementIndex (Lkotlinx/serialization/descriptors/SerialDescriptor;)I
public fun decodeFloatElement (Lkotlinx/serialization/descriptors/SerialDescriptor;I)F
public fun decodeInlineElement (Lkotlinx/serialization/descriptors/SerialDescriptor;I)Lkotlinx/serialization/encoding/Decoder;
public fun decodeIntElement (Lkotlinx/serialization/descriptors/SerialDescriptor;I)I
public fun decodeLongElement (Lkotlinx/serialization/descriptors/SerialDescriptor;I)J
public fun decodeNullableSerializableElement (Lkotlinx/serialization/descriptors/SerialDescriptor;ILkotlinx/serialization/DeserializationStrategy;Ljava/lang/Object;)Ljava/lang/Object;
public fun decodeSequentially ()Z
public fun decodeSerializableElement (Lkotlinx/serialization/descriptors/SerialDescriptor;ILkotlinx/serialization/DeserializationStrategy;Ljava/lang/Object;)Ljava/lang/Object;
public fun decodeShortElement (Lkotlinx/serialization/descriptors/SerialDescriptor;I)S
public fun decodeStringElement (Lkotlinx/serialization/descriptors/SerialDescriptor;I)Ljava/lang/String;
public fun endStructure (Lkotlinx/serialization/descriptors/SerialDescriptor;)V
public fun getSerializersModule ()Lkotlinx/serialization/modules/SerializersModule;
}

public class dev/gitlive/firebase/internal/FirebaseCompositeEncoder : kotlinx/serialization/encoding/CompositeEncoder {
public fun <init> (Ldev/gitlive/firebase/EncodeSettings;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function3;)V
public synthetic fun <init> (Ldev/gitlive/firebase/EncodeSettings;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function3;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun encodeBooleanElement (Lkotlinx/serialization/descriptors/SerialDescriptor;IZ)V
public fun encodeByteElement (Lkotlinx/serialization/descriptors/SerialDescriptor;IB)V
public fun encodeCharElement (Lkotlinx/serialization/descriptors/SerialDescriptor;IC)V
public fun encodeDoubleElement (Lkotlinx/serialization/descriptors/SerialDescriptor;ID)V
public fun encodeFloatElement (Lkotlinx/serialization/descriptors/SerialDescriptor;IF)V
public fun encodeInlineElement (Lkotlinx/serialization/descriptors/SerialDescriptor;I)Lkotlinx/serialization/encoding/Encoder;
public fun encodeIntElement (Lkotlinx/serialization/descriptors/SerialDescriptor;II)V
public fun encodeLongElement (Lkotlinx/serialization/descriptors/SerialDescriptor;IJ)V
public fun encodeNullableSerializableElement (Lkotlinx/serialization/descriptors/SerialDescriptor;ILkotlinx/serialization/SerializationStrategy;Ljava/lang/Object;)V
public final fun encodeObject (Lkotlinx/serialization/descriptors/SerialDescriptor;ILjava/lang/Object;)V
public final fun encodePolymorphicClassDiscriminator (Ljava/lang/String;Ljava/lang/String;)V
public fun encodeSerializableElement (Lkotlinx/serialization/descriptors/SerialDescriptor;ILkotlinx/serialization/SerializationStrategy;Ljava/lang/Object;)V
public fun encodeShortElement (Lkotlinx/serialization/descriptors/SerialDescriptor;IS)V
public fun encodeStringElement (Lkotlinx/serialization/descriptors/SerialDescriptor;ILjava/lang/String;)V
public fun endStructure (Lkotlinx/serialization/descriptors/SerialDescriptor;)V
public fun getSerializersModule ()Lkotlinx/serialization/modules/SerializersModule;
public fun shouldEncodeElementDefault (Lkotlinx/serialization/descriptors/SerialDescriptor;I)Z
}

public final class dev/gitlive/firebase/internal/FirebaseDecoder : kotlinx/serialization/encoding/Decoder {
public final class dev/gitlive/firebase/internal/FirebaseDecoderImpl : dev/gitlive/firebase/FirebaseDecoder {
public fun <init> (Ljava/lang/Object;)V
public fun <init> (Ljava/lang/Object;Ldev/gitlive/firebase/DecodeSettings;)V
public fun beginStructure (Lkotlinx/serialization/descriptors/SerialDescriptor;)Lkotlinx/serialization/encoding/CompositeDecoder;
Expand All @@ -153,7 +103,7 @@ public final class dev/gitlive/firebase/internal/FirebaseDecoder : kotlinx/seria
public final fun getValue ()Ljava/lang/Object;
}

public final class dev/gitlive/firebase/internal/FirebaseEncoder : kotlinx/serialization/encoding/Encoder {
public final class dev/gitlive/firebase/internal/FirebaseEncoderImpl : dev/gitlive/firebase/FirebaseEncoder {
public fun <init> (Ldev/gitlive/firebase/EncodeSettings;)V
public fun <init> (Z)V
public fun beginCollection (Lkotlinx/serialization/descriptors/SerialDescriptor;I)Lkotlinx/serialization/encoding/CompositeEncoder;
Expand Down Expand Up @@ -217,25 +167,3 @@ public final class dev/gitlive/firebase/internal/SpecialValueSerializer : kotlin
public fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
}

public final class dev/gitlive/firebase/internal/ValueWithSerializer {
public fun <init> (Ljava/lang/Object;Lkotlinx/serialization/SerializationStrategy;)V
public final fun component1 ()Ljava/lang/Object;
public final fun component2 ()Lkotlinx/serialization/SerializationStrategy;
public final fun copy (Ljava/lang/Object;Lkotlinx/serialization/SerializationStrategy;)Ldev/gitlive/firebase/internal/ValueWithSerializer;
public static synthetic fun copy$default (Ldev/gitlive/firebase/internal/ValueWithSerializer;Ljava/lang/Object;Lkotlinx/serialization/SerializationStrategy;ILjava/lang/Object;)Ldev/gitlive/firebase/internal/ValueWithSerializer;
public fun equals (Ljava/lang/Object;)Z
public final fun getSerializer ()Lkotlinx/serialization/SerializationStrategy;
public final fun getValue ()Ljava/lang/Object;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class dev/gitlive/firebase/internal/_decodersKt {
public static final fun getPolymorphicType (Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/String;
public static final fun structureDecoder (Ldev/gitlive/firebase/internal/FirebaseDecoder;Lkotlinx/serialization/descriptors/SerialDescriptor;Z)Lkotlinx/serialization/encoding/CompositeDecoder;
}

public final class dev/gitlive/firebase/internal/_encodersKt {
public static final fun structureEncoder (Ldev/gitlive/firebase/internal/FirebaseEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)Ldev/gitlive/firebase/internal/FirebaseCompositeEncoder;
}

76 changes: 2 additions & 74 deletions firebase-common-internal/api/jvm/firebase-common-internal.api
Original file line number Diff line number Diff line change
Expand Up @@ -78,59 +78,9 @@ public final class dev/gitlive/firebase/internal/EncodersKt {
public static final fun encode (Lkotlinx/serialization/SerializationStrategy;Ljava/lang/Object;Z)Ljava/lang/Object;
public static final fun encodeAsObject (Lkotlinx/serialization/SerializationStrategy;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Ldev/gitlive/firebase/internal/EncodedObject;
public static synthetic fun encodeAsObject$default (Lkotlinx/serialization/SerializationStrategy;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ldev/gitlive/firebase/internal/EncodedObject;
public static final fun withSerializer (Ljava/lang/Object;Lkotlinx/serialization/SerializationStrategy;)Ljava/lang/Object;
}

public final class dev/gitlive/firebase/internal/FirebaseClassDecoder : dev/gitlive/firebase/internal/FirebaseCompositeDecoder {
public fun <init> (ILdev/gitlive/firebase/DecodeSettings;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function2;)V
public fun decodeElementIndex (Lkotlinx/serialization/descriptors/SerialDescriptor;)I
public fun decodeSequentially ()Z
}

public class dev/gitlive/firebase/internal/FirebaseCompositeDecoder : kotlinx/serialization/encoding/CompositeDecoder {
public fun <init> (ILdev/gitlive/firebase/DecodeSettings;Lkotlin/jvm/functions/Function2;)V
public fun decodeBooleanElement (Lkotlinx/serialization/descriptors/SerialDescriptor;I)Z
public fun decodeByteElement (Lkotlinx/serialization/descriptors/SerialDescriptor;I)B
public fun decodeCharElement (Lkotlinx/serialization/descriptors/SerialDescriptor;I)C
public fun decodeCollectionSize (Lkotlinx/serialization/descriptors/SerialDescriptor;)I
public fun decodeDoubleElement (Lkotlinx/serialization/descriptors/SerialDescriptor;I)D
public fun decodeElementIndex (Lkotlinx/serialization/descriptors/SerialDescriptor;)I
public fun decodeFloatElement (Lkotlinx/serialization/descriptors/SerialDescriptor;I)F
public fun decodeInlineElement (Lkotlinx/serialization/descriptors/SerialDescriptor;I)Lkotlinx/serialization/encoding/Decoder;
public fun decodeIntElement (Lkotlinx/serialization/descriptors/SerialDescriptor;I)I
public fun decodeLongElement (Lkotlinx/serialization/descriptors/SerialDescriptor;I)J
public fun decodeNullableSerializableElement (Lkotlinx/serialization/descriptors/SerialDescriptor;ILkotlinx/serialization/DeserializationStrategy;Ljava/lang/Object;)Ljava/lang/Object;
public fun decodeSequentially ()Z
public fun decodeSerializableElement (Lkotlinx/serialization/descriptors/SerialDescriptor;ILkotlinx/serialization/DeserializationStrategy;Ljava/lang/Object;)Ljava/lang/Object;
public fun decodeShortElement (Lkotlinx/serialization/descriptors/SerialDescriptor;I)S
public fun decodeStringElement (Lkotlinx/serialization/descriptors/SerialDescriptor;I)Ljava/lang/String;
public fun endStructure (Lkotlinx/serialization/descriptors/SerialDescriptor;)V
public fun getSerializersModule ()Lkotlinx/serialization/modules/SerializersModule;
}

public class dev/gitlive/firebase/internal/FirebaseCompositeEncoder : kotlinx/serialization/encoding/CompositeEncoder {
public fun <init> (Ldev/gitlive/firebase/EncodeSettings;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function3;)V
public synthetic fun <init> (Ldev/gitlive/firebase/EncodeSettings;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function3;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun encodeBooleanElement (Lkotlinx/serialization/descriptors/SerialDescriptor;IZ)V
public fun encodeByteElement (Lkotlinx/serialization/descriptors/SerialDescriptor;IB)V
public fun encodeCharElement (Lkotlinx/serialization/descriptors/SerialDescriptor;IC)V
public fun encodeDoubleElement (Lkotlinx/serialization/descriptors/SerialDescriptor;ID)V
public fun encodeFloatElement (Lkotlinx/serialization/descriptors/SerialDescriptor;IF)V
public fun encodeInlineElement (Lkotlinx/serialization/descriptors/SerialDescriptor;I)Lkotlinx/serialization/encoding/Encoder;
public fun encodeIntElement (Lkotlinx/serialization/descriptors/SerialDescriptor;II)V
public fun encodeLongElement (Lkotlinx/serialization/descriptors/SerialDescriptor;IJ)V
public fun encodeNullableSerializableElement (Lkotlinx/serialization/descriptors/SerialDescriptor;ILkotlinx/serialization/SerializationStrategy;Ljava/lang/Object;)V
public final fun encodeObject (Lkotlinx/serialization/descriptors/SerialDescriptor;ILjava/lang/Object;)V
public final fun encodePolymorphicClassDiscriminator (Ljava/lang/String;Ljava/lang/String;)V
public fun encodeSerializableElement (Lkotlinx/serialization/descriptors/SerialDescriptor;ILkotlinx/serialization/SerializationStrategy;Ljava/lang/Object;)V
public fun encodeShortElement (Lkotlinx/serialization/descriptors/SerialDescriptor;IS)V
public fun encodeStringElement (Lkotlinx/serialization/descriptors/SerialDescriptor;ILjava/lang/String;)V
public fun endStructure (Lkotlinx/serialization/descriptors/SerialDescriptor;)V
public fun getSerializersModule ()Lkotlinx/serialization/modules/SerializersModule;
public fun shouldEncodeElementDefault (Lkotlinx/serialization/descriptors/SerialDescriptor;I)Z
}

public final class dev/gitlive/firebase/internal/FirebaseDecoder : kotlinx/serialization/encoding/Decoder {
public final class dev/gitlive/firebase/internal/FirebaseDecoderImpl : dev/gitlive/firebase/FirebaseDecoder {
public fun <init> (Ljava/lang/Object;)V
public fun <init> (Ljava/lang/Object;Ldev/gitlive/firebase/DecodeSettings;)V
public fun beginStructure (Lkotlinx/serialization/descriptors/SerialDescriptor;)Lkotlinx/serialization/encoding/CompositeDecoder;
Expand All @@ -153,7 +103,7 @@ public final class dev/gitlive/firebase/internal/FirebaseDecoder : kotlinx/seria
public final fun getValue ()Ljava/lang/Object;
}

public final class dev/gitlive/firebase/internal/FirebaseEncoder : kotlinx/serialization/encoding/Encoder {
public final class dev/gitlive/firebase/internal/FirebaseEncoderImpl : dev/gitlive/firebase/FirebaseEncoder {
public fun <init> (Ldev/gitlive/firebase/EncodeSettings;)V
public fun <init> (Z)V
public fun beginCollection (Lkotlinx/serialization/descriptors/SerialDescriptor;I)Lkotlinx/serialization/encoding/CompositeEncoder;
Expand Down Expand Up @@ -217,25 +167,3 @@ public final class dev/gitlive/firebase/internal/SpecialValueSerializer : kotlin
public fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
}

public final class dev/gitlive/firebase/internal/ValueWithSerializer {
public fun <init> (Ljava/lang/Object;Lkotlinx/serialization/SerializationStrategy;)V
public final fun component1 ()Ljava/lang/Object;
public final fun component2 ()Lkotlinx/serialization/SerializationStrategy;
public final fun copy (Ljava/lang/Object;Lkotlinx/serialization/SerializationStrategy;)Ldev/gitlive/firebase/internal/ValueWithSerializer;
public static synthetic fun copy$default (Ldev/gitlive/firebase/internal/ValueWithSerializer;Ljava/lang/Object;Lkotlinx/serialization/SerializationStrategy;ILjava/lang/Object;)Ldev/gitlive/firebase/internal/ValueWithSerializer;
public fun equals (Ljava/lang/Object;)Z
public final fun getSerializer ()Lkotlinx/serialization/SerializationStrategy;
public final fun getValue ()Ljava/lang/Object;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class dev/gitlive/firebase/internal/_decodersKt {
public static final fun getPolymorphicType (Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/String;
public static final fun structureDecoder (Ldev/gitlive/firebase/internal/FirebaseDecoder;Lkotlinx/serialization/descriptors/SerialDescriptor;Z)Lkotlinx/serialization/encoding/CompositeDecoder;
}

public final class dev/gitlive/firebase/internal/_encodersKt {
public static final fun structureEncoder (Ldev/gitlive/firebase/internal/FirebaseEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)Ldev/gitlive/firebase/internal/FirebaseCompositeEncoder;
}

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.descriptors.StructureKind
import kotlinx.serialization.encoding.CompositeDecoder

public actual fun FirebaseDecoder.structureDecoder(descriptor: SerialDescriptor, polymorphicIsNested: Boolean): CompositeDecoder = when (descriptor.kind) {
internal actual fun FirebaseDecoderImpl.structureDecoder(descriptor: SerialDescriptor, polymorphicIsNested: Boolean): CompositeDecoder = when (descriptor.kind) {
StructureKind.CLASS, StructureKind.OBJECT -> decodeAsMap(false)
StructureKind.LIST -> (value as? List<*>).orEmpty().let {
FirebaseCompositeDecoder(it.size, settings) { _, index -> it[index] }
Expand All @@ -26,10 +26,10 @@ public actual fun FirebaseDecoder.structureDecoder(descriptor: SerialDescriptor,
else -> TODO("The firebase-kotlin-sdk does not support $descriptor for serialization yet")
}

public actual fun getPolymorphicType(value: Any?, discriminator: String): String =
internal actual fun getPolymorphicType(value: Any?, discriminator: String): String =
(value as? Map<*, *>).orEmpty()[discriminator] as String

private fun FirebaseDecoder.decodeAsMap(isNestedPolymorphic: Boolean): CompositeDecoder = (value as? Map<*, *>).orEmpty().let { map ->
private fun FirebaseDecoderImpl.decodeAsMap(isNestedPolymorphic: Boolean): CompositeDecoder = (value as? Map<*, *>).orEmpty().let { map ->
FirebaseClassDecoder(map.size, settings, { map.containsKey(it) }) { desc, index ->
if (isNestedPolymorphic) {
if (desc.getElementName(index) == "value") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.descriptors.StructureKind
import kotlin.collections.set

public actual fun FirebaseEncoder.structureEncoder(descriptor: SerialDescriptor): FirebaseCompositeEncoder = when (descriptor.kind) {
internal actual fun FirebaseEncoderImpl.structureEncoder(descriptor: SerialDescriptor): FirebaseCompositeEncoder = when (descriptor.kind) {
StructureKind.LIST -> mutableListOf<Any?>()
.also { value = it }
.let { FirebaseCompositeEncoder(settings) { _, index, value -> it.add(index, value) } }
Expand All @@ -20,7 +20,7 @@ public actual fun FirebaseEncoder.structureEncoder(descriptor: SerialDescriptor)
else -> TODO("The firebase-kotlin-sdk does not support $descriptor for serialization yet")
}

private fun FirebaseEncoder.encodeAsMap(descriptor: SerialDescriptor): FirebaseCompositeEncoder = mutableMapOf<Any?, Any?>()
private fun FirebaseEncoderImpl.encodeAsMap(descriptor: SerialDescriptor): FirebaseCompositeEncoder = mutableMapOf<Any?, Any?>()
.also { value = it }
.let {
FirebaseCompositeEncoder(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import kotlinx.serialization.internal.AbstractPolymorphicSerializer
* See https://github.com/Kotlin/kotlinx.serialization/blob/master/formats/json/commonMain/src/kotlinx/serialization/json/internal/Polymorphic.kt
*/
@Suppress("UNCHECKED_CAST")
internal fun <T> FirebaseEncoder.encodePolymorphically(
internal fun <T> FirebaseEncoderImpl.encodePolymorphically(
serializer: SerializationStrategy<T>,
value: T,
ifPolymorphic: (String) -> Unit,
Expand All @@ -34,7 +34,7 @@ internal fun <T> FirebaseEncoder.encodePolymorphically(
}

@Suppress("UNCHECKED_CAST")
internal fun <T> FirebaseDecoder.decodeSerializableValuePolymorphic(
internal fun <T> FirebaseDecoderImpl.decodeSerializableValuePolymorphic(
value: Any?,
deserializer: DeserializationStrategy<T>,
): T {
Expand Down
Loading