Skip to content

Commit 0a1b6d8

Browse files
authored
Fix minor documentation and comment typos (#2061)
1 parent 0f35682 commit 0a1b6d8

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

core/commonMain/src/kotlinx/serialization/SerializationExceptions.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import kotlinx.serialization.encoding.*
3333
*
3434
* For general "catch-all" patterns around deserialization of potentially
3535
* untrusted/invalid/corrupted data it is recommended to catch `IllegalArgumentException` type
36-
* to avoid catching irrelevant to serializaton errors such as `OutOfMemoryError` or domain-specific ones.
36+
* to avoid catching irrelevant to serialization errors such as `OutOfMemoryError` or domain-specific ones.
3737
*/
3838
public open class SerializationException : IllegalArgumentException {
3939

formats/json/commonMain/src/kotlinx/serialization/json/internal/StreamingJsonDecoder.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ internal open class StreamingJsonDecoder(
5757
* dSVP reads the very next JSON tree into a memory as JsonElement and then runs TreeJsonDecoder over it
5858
* in order to deal with an arbitrary order of keys, but with the price of additional memory pressure
5959
* and CPU consumption.
60-
* We would like to provide best possible performance for data produced by kotlinx.serialization
60+
* We would like to provide the best possible performance for data produced by kotlinx.serialization
6161
* itself, for that we do the following optimistic optimization:
6262
*
6363
* 0) Remember current position in the string
6464
* 1) Read the very next key of JSON structure
65-
* 2) If it matches* the descriminator key, read the value, remember current position
65+
* 2) If it matches* the discriminator key, read the value, remember current position
6666
* 3) Return the value, recover an initial position
6767
* (*) -- if it doesn't match, fallback to dSVP method.
6868
*/
@@ -114,7 +114,7 @@ internal open class StreamingJsonDecoder(
114114
}
115115

116116
override fun endStructure(descriptor: SerialDescriptor) {
117-
// If we're ignoring unknown keys, we have to skip all undecoded elements,
117+
// If we're ignoring unknown keys, we have to skip all un-decoded elements,
118118
// e.g. for object serialization. It can be the case when the descriptor does
119119
// not have any elements and decodeElementIndex is not invoked at all
120120
if (json.configuration.ignoreUnknownKeys && descriptor.elementsCount == 0) {
@@ -246,8 +246,8 @@ internal open class StreamingJsonDecoder(
246246
if (configuration.ignoreUnknownKeys || discriminatorHolder.trySkip(key)) {
247247
lexer.skipElement(configuration.isLenient)
248248
} else {
249-
// Here we cannot properly update json path indicies
250-
// as we do not have a proper SerialDecriptor in our hands
249+
// Here we cannot properly update json path indices
250+
// as we do not have a proper SerialDescriptor in our hands
251251
lexer.failOnUnknownKey(key)
252252
}
253253
return lexer.tryConsumeComma()
@@ -268,8 +268,8 @@ internal open class StreamingJsonDecoder(
268268

269269
override fun decodeBoolean(): Boolean {
270270
/*
271-
* We prohibit non true/false boolean literals at all as it is considered way too error-prone,
272-
* but allow quoted literal in relaxed mode for booleans.
271+
* We prohibit any boolean literal that is not strictly 'true' or 'false' as it is considered way too
272+
* error-prone, but allow quoted literal in relaxed mode for booleans.
273273
*/
274274
return if (configuration.isLenient) {
275275
lexer.consumeBooleanLenient()

0 commit comments

Comments
 (0)