-
-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #527 This PR shortens the `"$type": "foo.bar.Qux"` tag that uPickle uses to distinguish between cases of a `sealed trait`, down to `"$type": "Qux"` or `"$type": "bar.Qux"`. Because the `trait` is `sealed`, upickle is able to look at all the other cases, and picks the shortest partially-qualified name that is enough to distinguish all the different cases. As mentioned in the original issue, this makes the serialization format more compact, more robust against code changes (e.g. changes in `package` name), and it homogenizes the serialization format of `sealed trait` hierarchies and Scala 3 `enum`s (which already use a short partially-qualified name as the `$type` tag) Despite being binary compatible at the JVM level, this is a backwards incompatible change that will need to go into uPickle 4.x. To ease the rollout, the implementation is able to read both old-style fully qualified `$type` tags as well as new-style partially-qualified `$type`-tags, and whether new-style output or old-style output is generated during serialization is controlled by a `objectTypeKeyWriteFullyQualified` flag. Someone migrating to uPickle 4.x from upickle 3.x can preserve the existing read/write behavior by replacing `upickle.default` with a `CustomPickler` with `objectTypeKeyWriteFullyQualified = true`, roll it out across their system so their entire system can read both old-style and new-style `$type` tags, and then flip individual components to `objectTypeKeyWriteFullyQualified = false` (or back to `upickle.default`). The system will work correctly with a mix of old-style and new-style `$type` tags being generated, until everything is on new-style `$type` tags.
- Loading branch information
Showing
14 changed files
with
470 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.