Question

I recently came across this framework and it seems really promising for what I need. I am testing some simple examples out and I'm curious why I can pickle my object but it can't find an unpickler. Here is my example:

import scala.pickling._
import json._
object JsonTest extends App {
  val simplePickled = new Simple(("test", 3)).pickle
  val unpickled = simplePickled.unpickle[Simple]
}
class Simple(val x: (String, Int)) {}

Cannot generate an unpickler for com.ft.Simple

Thanks in advance for any help.

Was it helpful?

Solution

This behavior is actually a regression introduced 3 days ago. We actually just resolved this and have pushed a fix less than 1-2 hours ago.

The code you posted above now works again:

scala> :paste
// Entering paste mode (ctrl-D to finish)

import scala.pickling._
import json._
object JsonTest extends App {
  val simplePickled = new Simple(("test", 3)).pickle
  val unpickled = simplePickled.unpickle[Simple]
}
class Simple(val x: (String, Int)) {}


// Exiting paste mode, now interpreting.

import scala.pickling._
import json._
defined module JsonTest
defined class Simple

I've also added your code snippet here as a test case in our test suite

If you're using the artifacts we publish on sonatype, you'll have to wait until the next artifact is published (tomorrow), or if you want the fix incorporated right away, you can just checkout and package scala/pickling with sbt and use the jar that sbt builds (sbt should print where it put the jar).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top