From 75fe326597834b806ebef5e5a9c06028078e88eb Mon Sep 17 00:00:00 2001 From: Charles Korn Date: Thu, 31 Jan 2019 17:51:52 +0900 Subject: [PATCH] Update to kotlinx.serialization 0.10.0. --- build.gradle.kts | 2 +- src/main/kotlin/com/charleskorn/kaml/Yaml.kt | 4 ++-- src/test/kotlin/com/charleskorn/kaml/YamlTest.kt | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 8acf03db..e2821c51 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -55,7 +55,7 @@ repositories { dependencies { compile(kotlin("stdlib-jdk8", "1.3.20")) compile(group = "org.snakeyaml", name = "snakeyaml-engine", version = "1.0") - compile(group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-runtime", version = "0.9.1") + compile(group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-runtime", version = "0.10.0") val spekVersion = "2.0.0-rc.1" diff --git a/src/main/kotlin/com/charleskorn/kaml/Yaml.kt b/src/main/kotlin/com/charleskorn/kaml/Yaml.kt index c0831c89..482d0ada 100644 --- a/src/main/kotlin/com/charleskorn/kaml/Yaml.kt +++ b/src/main/kotlin/com/charleskorn/kaml/Yaml.kt @@ -28,13 +28,13 @@ import org.snakeyaml.engine.v1.api.StreamDataWriter import java.io.StringWriter class Yaml : AbstractSerialFormat(), StringFormat { - override fun parse(serializer: DeserializationStrategy, string: String): T { + override fun parse(deserializer: DeserializationStrategy, string: String): T { val parser = YamlParser(string) val rootNode = YamlNode.fromParser(parser) parser.ensureEndOfStreamReached() val input = YamlInput.createFor(rootNode, context) - return input.decode(serializer) + return input.decode(deserializer) } override fun stringify(serializer: SerializationStrategy, obj: T): String { diff --git a/src/test/kotlin/com/charleskorn/kaml/YamlTest.kt b/src/test/kotlin/com/charleskorn/kaml/YamlTest.kt index fb260ed2..6939ab79 100644 --- a/src/test/kotlin/com/charleskorn/kaml/YamlTest.kt +++ b/src/test/kotlin/com/charleskorn/kaml/YamlTest.kt @@ -1023,8 +1023,8 @@ object YamlTest : Spek({ override val descriptor: SerialDescriptor get() = StringDescriptor - override fun deserialize(input: Decoder): Inner = Inner("from context serializer") - override fun serialize(output: Encoder, obj: Inner) = throw UnsupportedOperationException() + override fun deserialize(decoder: Decoder): Inner = Inner("from context serializer") + override fun serialize(encoder: Encoder, obj: Inner) = throw UnsupportedOperationException() } val module = SimpleModule(Inner::class, contextSerializer) @@ -1495,13 +1495,13 @@ object LocationThrowingSerializer : KSerializer { override val descriptor: SerialDescriptor get() = StringDescriptor - override fun deserialize(input: Decoder): CustomSerializedValue { - val location = (input as YamlInput).getCurrentLocation() + override fun deserialize(decoder: Decoder): CustomSerializedValue { + val location = (decoder as YamlInput).getCurrentLocation() throw LocationInformationException("Serializer called with location: ${location.line}, ${location.column}") } - override fun serialize(output: Encoder, obj: CustomSerializedValue) = throw UnsupportedOperationException() + override fun serialize(encoder: Encoder, obj: CustomSerializedValue) = throw UnsupportedOperationException() } class LocationInformationException(message: String) : RuntimeException(message)