From c0660760ab3f7806c2c31ddb5d49f7adb5ac690e Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Thu, 13 Oct 2022 15:17:40 +0200 Subject: [PATCH 1/4] typo serializaton -> serialization --- .../src/kotlinx/serialization/SerializationExceptions.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/commonMain/src/kotlinx/serialization/SerializationExceptions.kt b/core/commonMain/src/kotlinx/serialization/SerializationExceptions.kt index 152f894a1b..7af9d9a409 100644 --- a/core/commonMain/src/kotlinx/serialization/SerializationExceptions.kt +++ b/core/commonMain/src/kotlinx/serialization/SerializationExceptions.kt @@ -33,7 +33,7 @@ import kotlinx.serialization.encoding.* * * For general "catch-all" patterns around deserialization of potentially * untrusted/invalid/corrupted data it is recommended to catch `IllegalArgumentException` type - * to avoid catching irrelevant to serializaton errors such as `OutOfMemoryError` or domain-specific ones. + * to avoid catching irrelevant to serialization errors such as `OutOfMemoryError` or domain-specific ones. */ public open class SerializationException : IllegalArgumentException { From 2a219df3f56e18f0208e2dd66ff3dea5d0a8e20a Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Thu, 13 Oct 2022 15:18:33 +0200 Subject: [PATCH 2/4] fix minor comments typos --- .../serialization/json/internal/StreamingJsonDecoder.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/formats/json/commonMain/src/kotlinx/serialization/json/internal/StreamingJsonDecoder.kt b/formats/json/commonMain/src/kotlinx/serialization/json/internal/StreamingJsonDecoder.kt index f4760bdd8c..275a001920 100644 --- a/formats/json/commonMain/src/kotlinx/serialization/json/internal/StreamingJsonDecoder.kt +++ b/formats/json/commonMain/src/kotlinx/serialization/json/internal/StreamingJsonDecoder.kt @@ -246,8 +246,8 @@ internal open class StreamingJsonDecoder( if (configuration.ignoreUnknownKeys || discriminatorHolder.trySkip(key)) { lexer.skipElement(configuration.isLenient) } else { - // Here we cannot properly update json path indicies - // as we do not have a proper SerialDecriptor in our hands + // Here we cannot properly update json path indices + // as we do not have a proper SerialDescriptor in our hands lexer.failOnUnknownKey(key) } return lexer.tryConsumeComma() From c482ca8c2fd217b1873c5048cceff1e01077144b Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Thu, 13 Oct 2022 15:19:50 +0200 Subject: [PATCH 3/4] fix minor comments typos --- .../serialization/json/internal/StreamingJsonDecoder.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/formats/json/commonMain/src/kotlinx/serialization/json/internal/StreamingJsonDecoder.kt b/formats/json/commonMain/src/kotlinx/serialization/json/internal/StreamingJsonDecoder.kt index 275a001920..03e94f4c8d 100644 --- a/formats/json/commonMain/src/kotlinx/serialization/json/internal/StreamingJsonDecoder.kt +++ b/formats/json/commonMain/src/kotlinx/serialization/json/internal/StreamingJsonDecoder.kt @@ -57,12 +57,12 @@ internal open class StreamingJsonDecoder( * dSVP reads the very next JSON tree into a memory as JsonElement and then runs TreeJsonDecoder over it * in order to deal with an arbitrary order of keys, but with the price of additional memory pressure * and CPU consumption. - * We would like to provide best possible performance for data produced by kotlinx.serialization + * We would like to provide the best possible performance for data produced by kotlinx.serialization * itself, for that we do the following optimistic optimization: * * 0) Remember current position in the string * 1) Read the very next key of JSON structure - * 2) If it matches* the descriminator key, read the value, remember current position + * 2) If it matches* the discriminator key, read the value, remember current position * 3) Return the value, recover an initial position * (*) -- if it doesn't match, fallback to dSVP method. */ @@ -114,7 +114,7 @@ internal open class StreamingJsonDecoder( } override fun endStructure(descriptor: SerialDescriptor) { - // If we're ignoring unknown keys, we have to skip all undecoded elements, + // If we're ignoring unknown keys, we have to skip all un-decoded elements, // e.g. for object serialization. It can be the case when the descriptor does // not have any elements and decodeElementIndex is not invoked at all if (json.configuration.ignoreUnknownKeys && descriptor.elementsCount == 0) { @@ -268,7 +268,7 @@ internal open class StreamingJsonDecoder( override fun decodeBoolean(): Boolean { /* - * We prohibit non true/false boolean literals at all as it is considered way too error-prone, + * We prohibit non-true/false boolean literals at all as it is considered way too error-prone, * but allow quoted literal in relaxed mode for booleans. */ return if (configuration.isLenient) { From 8c1b311cb1a342ad83ec2b929daab30ae76d67d9 Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Thu, 13 Oct 2022 16:24:04 +0200 Subject: [PATCH 4/4] update unclear "non true/false" comment --- .../serialization/json/internal/StreamingJsonDecoder.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/formats/json/commonMain/src/kotlinx/serialization/json/internal/StreamingJsonDecoder.kt b/formats/json/commonMain/src/kotlinx/serialization/json/internal/StreamingJsonDecoder.kt index 03e94f4c8d..8e19e66e2b 100644 --- a/formats/json/commonMain/src/kotlinx/serialization/json/internal/StreamingJsonDecoder.kt +++ b/formats/json/commonMain/src/kotlinx/serialization/json/internal/StreamingJsonDecoder.kt @@ -268,8 +268,8 @@ internal open class StreamingJsonDecoder( override fun decodeBoolean(): Boolean { /* - * We prohibit non-true/false boolean literals at all as it is considered way too error-prone, - * but allow quoted literal in relaxed mode for booleans. + * We prohibit any boolean literal that is not strictly 'true' or 'false' as it is considered way too + * error-prone, but allow quoted literal in relaxed mode for booleans. */ return if (configuration.isLenient) { lexer.consumeBooleanLenient()