From 4948b8d3e940f52cd4cd31da15e314e00c0bc8ee Mon Sep 17 00:00:00 2001 From: Peter van Rensburg Date: Wed, 16 Sep 2020 18:01:59 -0600 Subject: [PATCH] add @ExperimentalSerializationApi annotations everywhere possible --- .../kotlinx/serialization/example/Example.kt | 2 ++ .../main/kotlin/kotlinx/serialization/csv/Csv.kt | 1 + .../serialization/csv/decode/ClassCsvDecoder.kt | 2 ++ .../csv/decode/CollectionCsvDecoder.kt | 2 ++ .../csv/decode/CollectionRecordCsvDecoder.kt | 2 ++ .../kotlinx/serialization/csv/decode/CsvDecoder.kt | 1 + .../serialization/csv/decode/ObjectCsvDecoder.kt | 2 ++ .../csv/decode/RecordListCsvDecoder.kt | 2 ++ .../serialization/csv/decode/RootCsvDecoder.kt | 2 ++ .../serialization/csv/decode/SealedCsvDecoder.kt | 2 ++ .../kotlinx/serialization/csv/encode/CsvEncoder.kt | 1 + .../serialization/csv/encode/ObjectCsvEncoder.kt | 2 ++ .../csv/encode/RecordListCsvEncoder.kt | 2 ++ .../serialization/csv/encode/RootCsvEncoder.kt | 2 ++ .../serialization/csv/encode/SealedCsvEncoder.kt | 2 ++ .../serialization/csv/encode/SimpleCsvEncoder.kt | 2 ++ .../serialization/csv/config/CsvDelimiterTest.kt | 2 ++ .../serialization/csv/config/CsvEmptyLinesTest.kt | 2 ++ .../serialization/csv/config/CsvEscapeCharTest.kt | 2 ++ .../csv/config/CsvHasHeaderRecordTest.kt | 2 ++ .../csv/config/CsvHasTrailingDelimiterTest.kt | 2 ++ .../serialization/csv/config/CsvNullStringTest.kt | 2 ++ .../serialization/csv/config/CsvQuoteCharTest.kt | 2 ++ .../serialization/csv/config/CsvQuoteModeTest.kt | 2 ++ .../csv/config/CsvRecordSeparatorTest.kt | 2 ++ .../serialization/csv/config/CsvUnitStringTest.kt | 2 ++ .../serialization/csv/decode/CsvQuotedTest.kt | 2 ++ .../serialization/csv/example/Serializers.kt | 13 ++++++------- .../serialization/csv/records/CsvCollectionsTest.kt | 2 ++ .../csv/records/CsvNestedRecordTest.kt | 2 ++ .../csv/records/CsvNullablePrimitivesTest.kt | 2 ++ .../csv/records/CsvNullableSimpleRecordTest.kt | 2 ++ .../serialization/csv/records/CsvObjectTest.kt | 2 ++ .../serialization/csv/records/CsvPrimitivesTest.kt | 2 ++ .../serialization/csv/records/CsvSealedKindTest.kt | 2 ++ .../csv/records/CsvSimpleRecordTest.kt | 2 ++ .../kotlinx/serialization/test/TestingFramework.kt | 4 ++++ 37 files changed, 77 insertions(+), 7 deletions(-) diff --git a/application/src/main/kotlin/de/brudaswen/kotlinx/serialization/example/Example.kt b/application/src/main/kotlin/de/brudaswen/kotlinx/serialization/example/Example.kt index 26feb76..03b77b7 100644 --- a/application/src/main/kotlin/de/brudaswen/kotlinx/serialization/example/Example.kt +++ b/application/src/main/kotlin/de/brudaswen/kotlinx/serialization/example/Example.kt @@ -1,5 +1,6 @@ package de.brudaswen.kotlinx.serialization.example +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.Serializable import kotlinx.serialization.builtins.ListSerializer import kotlinx.serialization.csv.Csv @@ -15,6 +16,7 @@ data class Appearance(val gender: Gender?, val age: Int?, val height: Double?) @Serializable enum class Gender { MALE, FEMALE } +@ExperimentalSerializationApi fun main() { val csv = Csv(CsvConfiguration(hasHeaderRecord = true)) diff --git a/library/src/main/kotlin/kotlinx/serialization/csv/Csv.kt b/library/src/main/kotlin/kotlinx/serialization/csv/Csv.kt index d5787ae..e24fb67 100644 --- a/library/src/main/kotlin/kotlinx/serialization/csv/Csv.kt +++ b/library/src/main/kotlin/kotlinx/serialization/csv/Csv.kt @@ -21,6 +21,7 @@ import kotlinx.serialization.modules.SerializersModule * @param configuration CSV settings used during parsing/serialization. * @param context Serialization module settings (e.g. custom serializers). */ +@ExperimentalSerializationApi class Csv( internal val configuration: CsvConfiguration, override val serializersModule: SerializersModule = EmptySerializersModule diff --git a/library/src/main/kotlin/kotlinx/serialization/csv/decode/ClassCsvDecoder.kt b/library/src/main/kotlin/kotlinx/serialization/csv/decode/ClassCsvDecoder.kt index 47a81f4..68c811d 100644 --- a/library/src/main/kotlin/kotlinx/serialization/csv/decode/ClassCsvDecoder.kt +++ b/library/src/main/kotlin/kotlinx/serialization/csv/decode/ClassCsvDecoder.kt @@ -1,5 +1,6 @@ package kotlinx.serialization.csv.decode +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.csv.Csv import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.descriptors.StructureKind @@ -10,6 +11,7 @@ import kotlinx.serialization.encoding.CompositeDecoder * * Supports header line such that class properties can be in different order. */ +@ExperimentalSerializationApi internal class ClassCsvDecoder( csv: Csv, reader: CsvReader, diff --git a/library/src/main/kotlin/kotlinx/serialization/csv/decode/CollectionCsvDecoder.kt b/library/src/main/kotlin/kotlinx/serialization/csv/decode/CollectionCsvDecoder.kt index 084cb70..8609017 100644 --- a/library/src/main/kotlin/kotlinx/serialization/csv/decode/CollectionCsvDecoder.kt +++ b/library/src/main/kotlin/kotlinx/serialization/csv/decode/CollectionCsvDecoder.kt @@ -1,5 +1,6 @@ package kotlinx.serialization.csv.decode +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.csv.Csv import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.encoding.CompositeDecoder @@ -9,6 +10,7 @@ import kotlinx.serialization.encoding.CompositeDecoder * * Expects that the first values defines the number of elements in the collection. */ +@ExperimentalSerializationApi internal class CollectionCsvDecoder( csv: Csv, reader: CsvReader, diff --git a/library/src/main/kotlin/kotlinx/serialization/csv/decode/CollectionRecordCsvDecoder.kt b/library/src/main/kotlin/kotlinx/serialization/csv/decode/CollectionRecordCsvDecoder.kt index 942b5ca..9f1eb29 100644 --- a/library/src/main/kotlin/kotlinx/serialization/csv/decode/CollectionRecordCsvDecoder.kt +++ b/library/src/main/kotlin/kotlinx/serialization/csv/decode/CollectionRecordCsvDecoder.kt @@ -1,5 +1,6 @@ package kotlinx.serialization.csv.decode +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.encoding.CompositeDecoder import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.csv.Csv @@ -11,6 +12,7 @@ import kotlinx.serialization.csv.Csv * Therefore, the number of elements is determined by reading until the end of line and the size of the collection is * not required and consequently not expected as the first value. */ +@ExperimentalSerializationApi internal class CollectionRecordCsvDecoder( csv: Csv, reader: CsvReader, diff --git a/library/src/main/kotlin/kotlinx/serialization/csv/decode/CsvDecoder.kt b/library/src/main/kotlin/kotlinx/serialization/csv/decode/CsvDecoder.kt index 09673d8..5d0de54 100644 --- a/library/src/main/kotlin/kotlinx/serialization/csv/decode/CsvDecoder.kt +++ b/library/src/main/kotlin/kotlinx/serialization/csv/decode/CsvDecoder.kt @@ -13,6 +13,7 @@ import kotlinx.serialization.modules.SerializersModule /** * Default CSV decoder. */ +@ExperimentalSerializationApi internal abstract class CsvDecoder( protected val csv: Csv, protected val reader: CsvReader, diff --git a/library/src/main/kotlin/kotlinx/serialization/csv/decode/ObjectCsvDecoder.kt b/library/src/main/kotlin/kotlinx/serialization/csv/decode/ObjectCsvDecoder.kt index 2fdd9d4..60ecba7 100644 --- a/library/src/main/kotlin/kotlinx/serialization/csv/decode/ObjectCsvDecoder.kt +++ b/library/src/main/kotlin/kotlinx/serialization/csv/decode/ObjectCsvDecoder.kt @@ -1,5 +1,6 @@ package kotlinx.serialization.csv.decode +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.csv.Csv @@ -9,6 +10,7 @@ import kotlinx.serialization.csv.Csv * Expects the name of the object (either fully-qualified class name or * [kotlinx.serialization.SerialName]). */ +@ExperimentalSerializationApi internal class ObjectCsvDecoder( csv: Csv, reader: CsvReader, diff --git a/library/src/main/kotlin/kotlinx/serialization/csv/decode/RecordListCsvDecoder.kt b/library/src/main/kotlin/kotlinx/serialization/csv/decode/RecordListCsvDecoder.kt index 96fcc71..240faaa 100644 --- a/library/src/main/kotlin/kotlinx/serialization/csv/decode/RecordListCsvDecoder.kt +++ b/library/src/main/kotlin/kotlinx/serialization/csv/decode/RecordListCsvDecoder.kt @@ -1,5 +1,6 @@ package kotlinx.serialization.csv.decode +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.encoding.CompositeDecoder import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.csv.Csv @@ -8,6 +9,7 @@ import kotlinx.serialization.descriptors.StructureKind /** * Decodes list of multiple CSV records/lines. */ +@ExperimentalSerializationApi internal class RecordListCsvDecoder( csv: Csv, reader: CsvReader diff --git a/library/src/main/kotlin/kotlinx/serialization/csv/decode/RootCsvDecoder.kt b/library/src/main/kotlin/kotlinx/serialization/csv/decode/RootCsvDecoder.kt index ed19826..425019f 100644 --- a/library/src/main/kotlin/kotlinx/serialization/csv/decode/RootCsvDecoder.kt +++ b/library/src/main/kotlin/kotlinx/serialization/csv/decode/RootCsvDecoder.kt @@ -1,5 +1,6 @@ package kotlinx.serialization.csv.decode +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.csv.Csv import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.descriptors.StructureKind @@ -12,6 +13,7 @@ import kotlinx.serialization.encoding.CompositeDecoder * (which is interpreted as multiple CSV records/lines). If this is the case, decoding continues in * [RecordListCsvDecoder]. */ +@ExperimentalSerializationApi internal class RootCsvDecoder( csv: Csv, reader: CsvReader diff --git a/library/src/main/kotlin/kotlinx/serialization/csv/decode/SealedCsvDecoder.kt b/library/src/main/kotlin/kotlinx/serialization/csv/decode/SealedCsvDecoder.kt index 23f0f95..fdae6cb 100644 --- a/library/src/main/kotlin/kotlinx/serialization/csv/decode/SealedCsvDecoder.kt +++ b/library/src/main/kotlin/kotlinx/serialization/csv/decode/SealedCsvDecoder.kt @@ -1,5 +1,6 @@ package kotlinx.serialization.csv.decode +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.csv.Csv import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.descriptors.StructureKind @@ -12,6 +13,7 @@ import kotlinx.serialization.encoding.CompositeDecoder * Expects columns for all possible child classes. The columns for the actual type should be filled and all other * columns are expected to contain `null` values. */ +@ExperimentalSerializationApi internal class SealedCsvDecoder( csv: Csv, reader: CsvReader, diff --git a/library/src/main/kotlin/kotlinx/serialization/csv/encode/CsvEncoder.kt b/library/src/main/kotlin/kotlinx/serialization/csv/encode/CsvEncoder.kt index 12fca1f..b4072e9 100644 --- a/library/src/main/kotlin/kotlinx/serialization/csv/encode/CsvEncoder.kt +++ b/library/src/main/kotlin/kotlinx/serialization/csv/encode/CsvEncoder.kt @@ -13,6 +13,7 @@ import kotlinx.serialization.modules.SerializersModule /** * Default CSV encoder. */ +@ExperimentalSerializationApi internal abstract class CsvEncoder( protected val csv: Csv, protected val writer: CsvWriter, diff --git a/library/src/main/kotlin/kotlinx/serialization/csv/encode/ObjectCsvEncoder.kt b/library/src/main/kotlin/kotlinx/serialization/csv/encode/ObjectCsvEncoder.kt index 8f3f47f..9acfd39 100644 --- a/library/src/main/kotlin/kotlinx/serialization/csv/encode/ObjectCsvEncoder.kt +++ b/library/src/main/kotlin/kotlinx/serialization/csv/encode/ObjectCsvEncoder.kt @@ -1,5 +1,6 @@ package kotlinx.serialization.csv.encode +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.csv.Csv @@ -9,6 +10,7 @@ import kotlinx.serialization.csv.Csv * Writes the name of the object (either fully-qualified class name or * [kotlinx.serialization.SerialName]). */ +@ExperimentalSerializationApi internal class ObjectCsvEncoder( csv: Csv, writer: CsvWriter, diff --git a/library/src/main/kotlin/kotlinx/serialization/csv/encode/RecordListCsvEncoder.kt b/library/src/main/kotlin/kotlinx/serialization/csv/encode/RecordListCsvEncoder.kt index 54a65d0..6aa9d79 100644 --- a/library/src/main/kotlin/kotlinx/serialization/csv/encode/RecordListCsvEncoder.kt +++ b/library/src/main/kotlin/kotlinx/serialization/csv/encode/RecordListCsvEncoder.kt @@ -1,5 +1,6 @@ package kotlinx.serialization.csv.encode +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.csv.Csv import kotlinx.serialization.encoding.CompositeEncoder @@ -7,6 +8,7 @@ import kotlinx.serialization.encoding.CompositeEncoder /** * Encodes list of multiple CSV records/lines. */ +@ExperimentalSerializationApi internal class RecordListCsvEncoder( csv: Csv, writer: CsvWriter diff --git a/library/src/main/kotlin/kotlinx/serialization/csv/encode/RootCsvEncoder.kt b/library/src/main/kotlin/kotlinx/serialization/csv/encode/RootCsvEncoder.kt index 8493a10..64e5c13 100644 --- a/library/src/main/kotlin/kotlinx/serialization/csv/encode/RootCsvEncoder.kt +++ b/library/src/main/kotlin/kotlinx/serialization/csv/encode/RootCsvEncoder.kt @@ -1,5 +1,6 @@ package kotlinx.serialization.csv.encode +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.csv.Csv import kotlinx.serialization.descriptors.StructureKind @@ -12,6 +13,7 @@ import kotlinx.serialization.encoding.CompositeEncoder * (which is interpreted as multiple CSV records/lines). If this is the case, encoding continues in * [RecordListCsvEncoder]. */ +@ExperimentalSerializationApi internal class RootCsvEncoder( csv: Csv, writer: CsvWriter diff --git a/library/src/main/kotlin/kotlinx/serialization/csv/encode/SealedCsvEncoder.kt b/library/src/main/kotlin/kotlinx/serialization/csv/encode/SealedCsvEncoder.kt index abcaa66..1e2ddaf 100644 --- a/library/src/main/kotlin/kotlinx/serialization/csv/encode/SealedCsvEncoder.kt +++ b/library/src/main/kotlin/kotlinx/serialization/csv/encode/SealedCsvEncoder.kt @@ -1,5 +1,6 @@ package kotlinx.serialization.csv.encode +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.csv.Csv import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.descriptors.StructureKind @@ -12,6 +13,7 @@ import kotlinx.serialization.encoding.CompositeEncoder * Writes columns for all possible child classes. The columns for the actual type get filled and all other columns * are filled with `null` values. */ +@ExperimentalSerializationApi internal class SealedCsvEncoder( csv: Csv, writer: CsvWriter, diff --git a/library/src/main/kotlin/kotlinx/serialization/csv/encode/SimpleCsvEncoder.kt b/library/src/main/kotlin/kotlinx/serialization/csv/encode/SimpleCsvEncoder.kt index 7fed512..a63f4a7 100644 --- a/library/src/main/kotlin/kotlinx/serialization/csv/encode/SimpleCsvEncoder.kt +++ b/library/src/main/kotlin/kotlinx/serialization/csv/encode/SimpleCsvEncoder.kt @@ -1,10 +1,12 @@ package kotlinx.serialization.csv.encode +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.csv.Csv /** * Default CSV encoder that writes each value into the next column. */ +@ExperimentalSerializationApi internal open class SimpleCsvEncoder( csv: Csv, writer: CsvWriter, diff --git a/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvDelimiterTest.kt b/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvDelimiterTest.kt index cf0407c..4794885 100644 --- a/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvDelimiterTest.kt +++ b/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvDelimiterTest.kt @@ -1,5 +1,6 @@ package kotlinx.serialization.csv.config +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.csv.Csv import kotlinx.serialization.csv.CsvConfiguration import kotlinx.serialization.csv.records.ComplexRecord @@ -10,6 +11,7 @@ import kotlin.test.Test /** * Test [Csv] with different [CsvConfiguration.delimiter]s. */ +@ExperimentalSerializationApi class CsvDelimiterTest { @Test diff --git a/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvEmptyLinesTest.kt b/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvEmptyLinesTest.kt index 736d283..d8d4958 100644 --- a/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvEmptyLinesTest.kt +++ b/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvEmptyLinesTest.kt @@ -1,5 +1,6 @@ package kotlinx.serialization.csv.config +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.builtins.ListSerializer import kotlinx.serialization.builtins.list import kotlinx.serialization.builtins.serializer @@ -13,6 +14,7 @@ import kotlin.test.Test /** * Test [Csv] with simple primitive records. */ +@ExperimentalSerializationApi class CsvEmptyLinesTest { @Test diff --git a/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvEscapeCharTest.kt b/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvEscapeCharTest.kt index ac765a9..acdc5b7 100644 --- a/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvEscapeCharTest.kt +++ b/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvEscapeCharTest.kt @@ -1,5 +1,6 @@ package kotlinx.serialization.csv.config +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.csv.Csv import kotlinx.serialization.csv.CsvConfiguration import kotlinx.serialization.csv.CsvConfiguration.QuoteMode.NONE @@ -11,6 +12,7 @@ import kotlin.test.Test /** * Test [Csv] with different [CsvConfiguration.escapeChar]s. */ +@ExperimentalSerializationApi class CsvEscapeCharTest { @Test diff --git a/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvHasHeaderRecordTest.kt b/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvHasHeaderRecordTest.kt index 7d89eba..ee3a2b2 100644 --- a/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvHasHeaderRecordTest.kt +++ b/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvHasHeaderRecordTest.kt @@ -1,5 +1,6 @@ package kotlinx.serialization.csv.config +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.builtins.ListSerializer import kotlinx.serialization.builtins.list import kotlinx.serialization.csv.Csv @@ -9,6 +10,7 @@ import kotlinx.serialization.test.assertParse import kotlinx.serialization.test.assertStringFormAndRestored import kotlin.test.Test +@ExperimentalSerializationApi class CsvHasHeaderRecordTest { @Test diff --git a/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvHasTrailingDelimiterTest.kt b/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvHasTrailingDelimiterTest.kt index 669e9ac..69ddb27 100644 --- a/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvHasTrailingDelimiterTest.kt +++ b/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvHasTrailingDelimiterTest.kt @@ -1,5 +1,6 @@ package kotlinx.serialization.csv.config +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.builtins.ListSerializer import kotlinx.serialization.builtins.list import kotlinx.serialization.builtins.serializer @@ -10,6 +11,7 @@ import kotlinx.serialization.csv.records.IntRecord import kotlinx.serialization.test.assertStringFormAndRestored import kotlin.test.Test +@ExperimentalSerializationApi class CsvHasTrailingDelimiterTest { @Test diff --git a/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvNullStringTest.kt b/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvNullStringTest.kt index b1dc789..f316041 100644 --- a/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvNullStringTest.kt +++ b/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvNullStringTest.kt @@ -1,5 +1,6 @@ package kotlinx.serialization.csv.config +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.csv.Csv import kotlinx.serialization.csv.CsvConfiguration import kotlinx.serialization.csv.records.NullRecord @@ -9,6 +10,7 @@ import kotlin.test.Test /** * Test [Csv] with different [CsvConfiguration.nullString]s. */ +@ExperimentalSerializationApi class CsvNullStringTest { @Test diff --git a/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvQuoteCharTest.kt b/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvQuoteCharTest.kt index 88a3654..d93777a 100644 --- a/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvQuoteCharTest.kt +++ b/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvQuoteCharTest.kt @@ -1,5 +1,6 @@ package kotlinx.serialization.csv.config +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.csv.Csv import kotlinx.serialization.csv.CsvConfiguration import kotlinx.serialization.csv.CsvConfiguration.QuoteMode.ALL @@ -11,6 +12,7 @@ import kotlin.test.Test /** * Test [Csv] with different [CsvConfiguration.quoteChar]s. */ +@ExperimentalSerializationApi class CsvQuoteCharTest { @Test diff --git a/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvQuoteModeTest.kt b/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvQuoteModeTest.kt index e5bd3ce..720fed8 100644 --- a/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvQuoteModeTest.kt +++ b/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvQuoteModeTest.kt @@ -1,5 +1,6 @@ package kotlinx.serialization.csv.config +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.csv.Csv import kotlinx.serialization.csv.CsvConfiguration import kotlinx.serialization.csv.CsvConfiguration.QuoteMode.* @@ -7,6 +8,7 @@ import kotlinx.serialization.csv.records.* import kotlinx.serialization.test.assertStringFormAndRestored import kotlin.test.Test +@ExperimentalSerializationApi class CsvQuoteModeTest { // TestString diff --git a/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvRecordSeparatorTest.kt b/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvRecordSeparatorTest.kt index a370a87..f0c2172 100644 --- a/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvRecordSeparatorTest.kt +++ b/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvRecordSeparatorTest.kt @@ -1,5 +1,6 @@ package kotlinx.serialization.csv.config +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.builtins.ListSerializer import kotlinx.serialization.builtins.list import kotlinx.serialization.csv.Csv @@ -11,6 +12,7 @@ import kotlin.test.Test /** * Test [Csv] with different [CsvConfiguration.recordSeparator]s. */ +@ExperimentalSerializationApi class CsvRecordSeparatorTest { @Test diff --git a/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvUnitStringTest.kt b/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvUnitStringTest.kt index 8350322..2d3c9a4 100644 --- a/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvUnitStringTest.kt +++ b/library/src/test/kotlin/kotlinx/serialization/csv/config/CsvUnitStringTest.kt @@ -1,5 +1,6 @@ package kotlinx.serialization.csv.config +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.csv.Csv import kotlinx.serialization.csv.records.UnitRecord import kotlinx.serialization.test.assertStringFormAndRestored @@ -8,6 +9,7 @@ import kotlin.test.Test /** * Test [Csv] with [kotlin.Unit]. */ +@ExperimentalSerializationApi class CsvUnitStringTest { @Test diff --git a/library/src/test/kotlin/kotlinx/serialization/csv/decode/CsvQuotedTest.kt b/library/src/test/kotlin/kotlinx/serialization/csv/decode/CsvQuotedTest.kt index 303eb02..5d8c4fc 100644 --- a/library/src/test/kotlin/kotlinx/serialization/csv/decode/CsvQuotedTest.kt +++ b/library/src/test/kotlin/kotlinx/serialization/csv/decode/CsvQuotedTest.kt @@ -1,5 +1,6 @@ package kotlinx.serialization.csv.decode +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.csv.Csv import kotlinx.serialization.csv.records.IntStringRecord import kotlinx.serialization.csv.records.StringRecord @@ -9,6 +10,7 @@ import kotlin.test.Test /** * Test [kotlinx.serialization.csv.decode.CsvDecoder] with quoted values. */ +@ExperimentalSerializationApi class CsvQuotedTest { @Test diff --git a/library/src/test/kotlin/kotlinx/serialization/csv/example/Serializers.kt b/library/src/test/kotlin/kotlinx/serialization/csv/example/Serializers.kt index 93ef3e5..57dc622 100644 --- a/library/src/test/kotlin/kotlinx/serialization/csv/example/Serializers.kt +++ b/library/src/test/kotlin/kotlinx/serialization/csv/example/Serializers.kt @@ -1,17 +1,17 @@ package kotlinx.serialization.csv.example -import kotlinx.serialization.* -import kotlinx.serialization.descriptors.SerialDescriptor -import kotlinx.serialization.descriptors.buildClassSerialDescriptor +import kotlinx.serialization.ExperimentalSerializationApi +import kotlinx.serialization.KSerializer +import kotlinx.serialization.Serializer import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Encoder import java.time.LocalDateTime import java.time.format.DateTimeFormatter -import java.util.* +import java.util.UUID +@ExperimentalSerializationApi @Serializer(forClass = UUID::class) object UUIDSerializer : KSerializer { -// override val descriptor: SerialDescriptor = buildClassSerialDescriptor("UUID", {}) override fun serialize(encoder: Encoder, value: UUID) = encoder.encodeString(value.toString()) @@ -20,12 +20,11 @@ object UUIDSerializer : KSerializer { UUID.fromString(decoder.decodeString()) } +@ExperimentalSerializationApi @Serializer(forClass = LocalDateTime::class) object LocalDateTimeSerializer : KSerializer { private val format = DateTimeFormatter.ISO_DATE_TIME -// override val descriptor: SerialDescriptor = buildClassSerialDescriptor("LocalDateTime", {}) - override fun serialize(encoder: Encoder, value: LocalDateTime) = encoder.encodeString(format.format(value)) diff --git a/library/src/test/kotlin/kotlinx/serialization/csv/records/CsvCollectionsTest.kt b/library/src/test/kotlin/kotlinx/serialization/csv/records/CsvCollectionsTest.kt index 6fe5ad3..daead65 100644 --- a/library/src/test/kotlin/kotlinx/serialization/csv/records/CsvCollectionsTest.kt +++ b/library/src/test/kotlin/kotlinx/serialization/csv/records/CsvCollectionsTest.kt @@ -1,5 +1,6 @@ package kotlinx.serialization.csv.records +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.Serializable import kotlinx.serialization.builtins.* import kotlinx.serialization.csv.Csv @@ -10,6 +11,7 @@ import kotlin.test.Test /** * Test [Csv] with [List]s, [Set]s and [Map]s. */ +@ExperimentalSerializationApi class CsvCollectionsTest { @Test diff --git a/library/src/test/kotlin/kotlinx/serialization/csv/records/CsvNestedRecordTest.kt b/library/src/test/kotlin/kotlinx/serialization/csv/records/CsvNestedRecordTest.kt index 5668a1a..c4f9b71 100644 --- a/library/src/test/kotlin/kotlinx/serialization/csv/records/CsvNestedRecordTest.kt +++ b/library/src/test/kotlin/kotlinx/serialization/csv/records/CsvNestedRecordTest.kt @@ -1,5 +1,6 @@ package kotlinx.serialization.csv.records +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.builtins.ListSerializer import kotlinx.serialization.builtins.list import kotlinx.serialization.csv.Csv @@ -7,6 +8,7 @@ import kotlinx.serialization.csv.CsvConfiguration import kotlinx.serialization.test.assertStringFormAndRestored import kotlin.test.Test +@ExperimentalSerializationApi class CsvNestedRecordTest { @Test diff --git a/library/src/test/kotlin/kotlinx/serialization/csv/records/CsvNullablePrimitivesTest.kt b/library/src/test/kotlin/kotlinx/serialization/csv/records/CsvNullablePrimitivesTest.kt index cc624d0..4b0f29c 100644 --- a/library/src/test/kotlin/kotlinx/serialization/csv/records/CsvNullablePrimitivesTest.kt +++ b/library/src/test/kotlin/kotlinx/serialization/csv/records/CsvNullablePrimitivesTest.kt @@ -1,5 +1,6 @@ package kotlinx.serialization.csv.records +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.builtins.ListSerializer import kotlinx.serialization.builtins.UnitSerializer import kotlinx.serialization.builtins.list @@ -13,6 +14,7 @@ import kotlin.test.Test /** * Test [Csv] with simple nullable primitive records. */ +@ExperimentalSerializationApi class CsvNullablePrimitivesTest { @Test diff --git a/library/src/test/kotlin/kotlinx/serialization/csv/records/CsvNullableSimpleRecordTest.kt b/library/src/test/kotlin/kotlinx/serialization/csv/records/CsvNullableSimpleRecordTest.kt index d51e94a..42aaf99 100644 --- a/library/src/test/kotlin/kotlinx/serialization/csv/records/CsvNullableSimpleRecordTest.kt +++ b/library/src/test/kotlin/kotlinx/serialization/csv/records/CsvNullableSimpleRecordTest.kt @@ -1,5 +1,6 @@ package kotlinx.serialization.csv.records +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.builtins.ListSerializer import kotlinx.serialization.builtins.list import kotlinx.serialization.builtins.nullable @@ -12,6 +13,7 @@ import kotlin.test.Test /** * Test [Csv] with simple nullable [Serializable] records. */ +@ExperimentalSerializationApi class CsvNullableSimpleRecordTest { @Test diff --git a/library/src/test/kotlin/kotlinx/serialization/csv/records/CsvObjectTest.kt b/library/src/test/kotlin/kotlinx/serialization/csv/records/CsvObjectTest.kt index 3f0b291..7b2695e 100644 --- a/library/src/test/kotlin/kotlinx/serialization/csv/records/CsvObjectTest.kt +++ b/library/src/test/kotlin/kotlinx/serialization/csv/records/CsvObjectTest.kt @@ -1,5 +1,6 @@ package kotlinx.serialization.csv.records +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.builtins.ListSerializer import kotlinx.serialization.builtins.nullable import kotlinx.serialization.csv.Csv @@ -11,6 +12,7 @@ import kotlin.test.Test /** * Test [Csv] with simple primitive records. */ +@ExperimentalSerializationApi class CsvObjectTest { @Test diff --git a/library/src/test/kotlin/kotlinx/serialization/csv/records/CsvPrimitivesTest.kt b/library/src/test/kotlin/kotlinx/serialization/csv/records/CsvPrimitivesTest.kt index b81db8d..82f4ae4 100644 --- a/library/src/test/kotlin/kotlinx/serialization/csv/records/CsvPrimitivesTest.kt +++ b/library/src/test/kotlin/kotlinx/serialization/csv/records/CsvPrimitivesTest.kt @@ -1,5 +1,6 @@ package kotlinx.serialization.csv.records +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.builtins.ListSerializer import kotlinx.serialization.builtins.UnitSerializer import kotlinx.serialization.builtins.list @@ -11,6 +12,7 @@ import kotlin.test.Test /** * Test [Csv] with simple primitive records. */ +@ExperimentalSerializationApi class CsvPrimitivesTest { @Test diff --git a/library/src/test/kotlin/kotlinx/serialization/csv/records/CsvSealedKindTest.kt b/library/src/test/kotlin/kotlinx/serialization/csv/records/CsvSealedKindTest.kt index d8b03d3..5a71f35 100644 --- a/library/src/test/kotlin/kotlinx/serialization/csv/records/CsvSealedKindTest.kt +++ b/library/src/test/kotlin/kotlinx/serialization/csv/records/CsvSealedKindTest.kt @@ -1,5 +1,6 @@ package kotlinx.serialization.csv.records +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.builtins.ListSerializer import kotlinx.serialization.builtins.list import kotlinx.serialization.builtins.nullable @@ -11,6 +12,7 @@ import kotlin.test.Test /** * Test [Csv] with simple primitive records. */ +@ExperimentalSerializationApi class CsvSealedKindTest { @Test diff --git a/library/src/test/kotlin/kotlinx/serialization/csv/records/CsvSimpleRecordTest.kt b/library/src/test/kotlin/kotlinx/serialization/csv/records/CsvSimpleRecordTest.kt index 1e6ab70..f174dfb 100644 --- a/library/src/test/kotlin/kotlinx/serialization/csv/records/CsvSimpleRecordTest.kt +++ b/library/src/test/kotlin/kotlinx/serialization/csv/records/CsvSimpleRecordTest.kt @@ -1,5 +1,6 @@ package kotlinx.serialization.csv.records +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.builtins.ListSerializer import kotlinx.serialization.builtins.list import kotlinx.serialization.csv.Csv @@ -10,6 +11,7 @@ import kotlin.test.Test /** * Test [Csv] with simple [Serializable] records. */ +@ExperimentalSerializationApi class CsvSimpleRecordTest { @Test diff --git a/library/src/test/kotlin/kotlinx/serialization/test/TestingFramework.kt b/library/src/test/kotlin/kotlinx/serialization/test/TestingFramework.kt index 46805d8..ba775b1 100644 --- a/library/src/test/kotlin/kotlinx/serialization/test/TestingFramework.kt +++ b/library/src/test/kotlin/kotlinx/serialization/test/TestingFramework.kt @@ -4,10 +4,12 @@ package kotlinx.serialization.test +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.KSerializer import kotlinx.serialization.StringFormat import kotlin.test.assertEquals +@ExperimentalSerializationApi inline fun assertStringFormAndRestored( expected: String, original: T, @@ -23,6 +25,7 @@ inline fun assertStringFormAndRestored( assertEquals(original, restored) } +@ExperimentalSerializationApi inline fun assertParse( input: String, expected: T, @@ -35,6 +38,7 @@ inline fun assertParse( assertEquals(expected, restored) } +@ExperimentalSerializationApi inline fun StringFormat.assertStringFormAndRestored( expected: String, original: T,