Skip to content

Commit

Permalink
Mark JsonEncoder and JsonDecoder unstable for inheritance
Browse files Browse the repository at this point in the history
Most of the users only use its stable methods and should not implement it directly, while we still want to have an opportunity to evolve it in the future, add new methods etc. E.g. the potential future addition could be 'decodeRawJson(): String' method for #1058
  • Loading branch information
qwwdfsad committed Sep 14, 2020
1 parent e3e58e3 commit 1df4d61
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ import kotlinx.serialization.encoding.updateModeDeprecated
* }
* }
* ```
*
* ### Not stable for inheritance
*
* `JsonDecoder` interface is not stable for inheritance in 3rd party libraries, as new methods
* might be added to this interface or contracts of the existing methods can be changed.
* Accepting this interface in your API methods, casting [Decoder] to [JsonDecoder] and invoking its
* methods is considered stable.
*/
public interface JsonDecoder : Decoder, CompositeDecoder {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ import kotlinx.serialization.encoding.*
* }
* }
* ```
*
* ### Not stable for inheritance
*
* `JsonEncoder` interface is not stable for inheritance in 3rd party libraries, as new methods
* might be added to this interface or contracts of the existing methods can be changed.
* Accepting this interface in your API methods, casting [Encoder] to [JsonEncoder] and invoking its
* methods is considered stable.
*/
public interface JsonEncoder : Encoder, CompositeEncoder {
/**
Expand Down

0 comments on commit 1df4d61

Please sign in to comment.