Skip to content

Commit c0daed5

Browse files
committed
Update the documentation in line with @sandwwraith's suggestions/feedback.
1 parent c6883ce commit c0daed5

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

docs/polymorphism.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -417,10 +417,11 @@ fun main() {
417417
418418
### Registering sealed children as subclasses
419419
A sealed parent interface or class can be used to directly register all its children using `subclassesOfSealed`.
420-
This will expose all children that would be available when serializing the parent directly, but now as sealed. Please
421-
note that this is will remain open serialization, and the sealed parent serializer will not be used in serialization.
422-
In addition, it is not valid if the hierarchy contains open (not sealed) polymorphic children (this will result in
423-
an error at runtime). In other words all children/descendants must be either concrete or sealed.
420+
This will allow serializing the children using open polymorphism without the need to register each one individually.
421+
422+
If one of the type's subclasses is a sealed serializable class on its own, its subclasses are registered recursively
423+
as well. However, if one of the type's subclasses is an open polymorphic class, an [IllegalArgumentException] is thrown.
424+
In other words, all children/descendants must be either concrete or sealed.
424425

425426
<!--- TEST -->
426427

0 commit comments

Comments
 (0)