suzaku-io / boopickle

Binary serialization library for efficient network communication

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pickler derivation for case object

cornerman opened this issue · comments

Using boopickle.Default._, I am not able to automatically generate a Pickler for a case object. It works using boopickle.shapeless.Default._, though.

Why would you need that? It's a no-op anyway, nothing would get serialized/deserialized.

I have an ADT that I am serializing and some sub classes are objects. Serialization being a no-op in this case is fine. But I do not get an autoderived Pickler.

The tests should cover case objects as well, for example this works fine:

  case object TestO

      'CaseObject {
        val bb = Pickle.intoBytes(TestO)
        // yea, pickling a case object takes no space at all :)
        assert(bb.limit == 0)
        val u = Unpickle[TestO.type].fromBytes(bb)
        assert(u == TestO)
      }

Is your situation somehow different?

Oh, you are right. I have overlooked that, in general, case objects seem to work. But still my situation is somehow different. The ADTs in question are generated by another macro, but the boopickle macros work for all these types except for objects. I am going to close this one, as this might not be general problem, but will come back with a better description, as soon as I found the cause. Until then, will continue to work with the shapeless derivation.