Skip to content

Commit 24ac6b8

Browse files
att55sandwwraith
authored andcommitted
Update polymorphism.md
1 parent 765d462 commit 24ac6b8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/polymorphism.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ Let us start with basic introduction to polymorphism.
4141

4242
### Static types
4343

44-
Kotlin serialization is fully static with respect to types by default. The structure of encoded objects is determined
44+
Kotlin Serialization is fully static with respect to types by default. The structure of encoded objects is determined
4545
by *compile-time* types of objects. Let's examine this aspect in more detail and learn how
4646
to serialize polymorphic data structures, where the type of data is determined at runtime.
4747

48-
To show the static nature of Kotlin serialization let us make the following setup. An `open class Project`
48+
To show the static nature of Kotlin Serialization let us make the following setup. An `open class Project`
4949
has just the `name` property, while its derived `class OwnedProject` adds an `owner` property.
5050
In the below example, we serialize `data` variable with a static type of
5151
`Project` that is initialized with an instance of `OwnedProject` at runtime.
@@ -194,7 +194,7 @@ discriminator property is not emitted into the resulting JSON.
194194

195195
<!--- TEST -->
196196

197-
In general, Kotlin serialization is designed to work correctly only when the compile-time type used during serialization
197+
In general, Kotlin Serialization is designed to work correctly only when the compile-time type used during serialization
198198
is the same one as the compile-time type used during deserialization. You can always specify the type explicitly
199199
when calling serialization functions. The previous example can be corrected to use `Project` type for serialization
200200
by calling `Json.encodeToString<Project>(data)`.
@@ -592,7 +592,7 @@ With the explicit serializer it works as before.
592592
### Explicitly marking polymorphic class properties
593593

594594
The property of an interface type is implicitly considered polymorphic, since interfaces are all about runtime polymorphism.
595-
However, Kotlin serialization does not compile a serializable class with a property of a non-serializable class type.
595+
However, Kotlin Serialization does not compile a serializable class with a property of a non-serializable class type.
596596
If we have a property of `Any` class or other non-serializable class, then we must explicitly provide its serialization
597597
strategy via the [`@Serializable`][Serializable] annotation as we saw in
598598
the [Specifying serializer on a property](serializers.md#specifying-serializer-on-a-property) section.
@@ -708,7 +708,7 @@ abstract class Response<out T>
708708
data class OkResponse<out T>(val data: T) : Response<T>()
709709
```
710710

711-
Kotlin serialization does not have a builtin strategy to represent the actually provided argument type for the
711+
Kotlin Serialization does not have a builtin strategy to represent the actually provided argument type for the
712712
type parameter `T` when serializing a property of the polymorphic type `OkResponse<T>`. We have to provide this
713713
strategy explicitly when defining the serializers module for the `Response`. In the below example we
714714
use `OkResponse.serializer(...)` to retrieve

0 commit comments

Comments
 (0)