Skip to content

Commit

Permalink
Update to kotlinx.serialization 0.10.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
charleskorn committed Jan 31, 2019
1 parent 1e681a7 commit 75fe326
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/com/charleskorn/kaml/Yaml.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ import org.snakeyaml.engine.v1.api.StreamDataWriter
import java.io.StringWriter

class Yaml : AbstractSerialFormat(), StringFormat {
override fun <T> parse(serializer: DeserializationStrategy<T>, string: String): T {
override fun <T> parse(deserializer: DeserializationStrategy<T>, 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 <T> stringify(serializer: SerializationStrategy<T>, obj: T): String {
Expand Down
10 changes: 5 additions & 5 deletions src/test/kotlin/com/charleskorn/kaml/YamlTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -1495,13 +1495,13 @@ object LocationThrowingSerializer : KSerializer<CustomSerializedValue> {
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)

0 comments on commit 75fe326

Please sign in to comment.