This repository has been archived by the owner on Feb 20, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Force generation to create (un)picklers together
* Macros generate `Pickler[T]`/`Unpickler[T]` together instead of creating them separately. This reduces final code size since now there's only one class instead of two and also improves the reuse of already generated picklers (see issue #409). * As now the return type of the implicit method is `AbstractPicklerUnpickler`, there can be some errors because of ambiguous implicit values (e.g. sealed-trait-static) when (un)picklers are explicitly called via `generate`. The fix is to only use `PicklerUnpickler.generate` and deprecate separate explicit creation with `Pickler.generate` and `Unpickler.generate`.
- Loading branch information
Showing
10 changed files
with
50 additions
and
92 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package scala.pickling.generation | ||
|
||
import org.scalatest.FunSuite | ||
import scala.pickling._, Defaults._, json._ | ||
|
||
class CheckGenPicklerUnpicklerTogether extends FunSuite { | ||
|
||
case class Pi(number: Int) | ||
|
||
test("check that pickler and unpickler are generated together (I)") { | ||
|
||
val p = implicitly[Pickler[Pi]] | ||
val u = implicitly[Unpickler[Pi]] | ||
|
||
assert(p === u) | ||
|
||
} | ||
|
||
} |
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