Skip to content
This repository has been archived by the owner on Feb 20, 2019. It is now read-only.

unpickle[Any] #114

Closed
vrahli opened this issue Mar 20, 2014 · 2 comments
Closed

unpickle[Any] #114

vrahli opened this issue Mar 20, 2014 · 2 comments

Comments

@vrahli
Copy link

vrahli commented Mar 20, 2014

I'm curious as why objA2 below is different from objA1.
objA2 is Pair(Pair(1,2),Pair(1,2)). The second 1 gets replaced by Pair(1,2).
The fact that the second 1 is a 1 matters. Changing it to something
else gives me the correct result.

Also, calling objB2.toString gives me a StackOverFlowError error.

What's going on?

import scala.pickling._
import binary._

object TestSerializer {

  case class Pair(val x: Any, val y: Any)

  def main(args : Array[String]) = {
    // TEST 1
    val objA1: Any = Pair(Pair(1,2),1)
    val sA: Array[Byte] = objA1.pickle.value
    println("serialized " + objA1)
    val objA2: Any = sA.unpickle[Any]
    println("deserialized " + objA2) // does not fail but gives the wrong answer

    // TEST 2
    val objB1: Any = Pair(1,Pair(1,2))
    val sB: Array[Byte] = objB1.pickle.value
    println("serialized " + objB1)
    val objB2: Any = sB.unpickle[Any]
    println("deserialized " + objB2) // fails
  }

}
@cocodrino
Copy link

I'm exactly in the same problem..please let me know if you find the solution, seems than heather is not so much active solving/responding issues :S ...I need picking to ByteString (the akka Array[byte] alternative)....

@jvican
Copy link
Member

jvican commented May 25, 2016

Addressed by #429. Works in latest 0.11.x.

@jvican jvican closed this as completed May 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants