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

Can't unpickle ValueSet #439

Open
cornim opened this issue Jul 12, 2016 · 2 comments
Open

Can't unpickle ValueSet #439

cornim opened this issue Jul 12, 2016 · 2 comments

Comments

@cornim
Copy link

cornim commented Jul 12, 2016

Hi,

I'm trying to pickle and unpickle a ValueSet, alas without success. Here is the repl input/output:

scala> import scala.pickling._
import scala.pickling._

scala> import json._
import json._

scala> object WindDirection extends Enumeration {
  val N, NE, E, SE, S, SW, W, NW = Value
}
defined object WindDirection

scala> val a = WindDirection.ValueSet(WindDirection.E, WindDirection.NE)
a: WindDirection.ValueSet = WindDirection.ValueSet(NE, E)

scala> val b = a.pickle
b: scala.pickling.json.JSONPickle =
JSONPickle({
  "tpe": "scala.Enumeration.ValueSet",
  "nnIds": {
    "tpe": "scala.collection.immutable.BitSet.BitSet1",
    "elems": "6"
  }
})

scala> val c = b.unpickle[WindDirection.ValueSet]
java.lang.RuntimeException: error: cannot find class or module with type name 'scala.Enumeration.ValueSet'
full type string: 'scala.Enumeration.ValueSet'
  at scala.sys.package$.error(package.scala:27)
  at scala.pickling.internal.package$.liftedTree1$1(package.scala:59)
  at scala.pickling.internal.package$.typeFromString(package.scala:54)
  at scala.pickling.FastTypeTag$.apply(FastTags.scala:69)
  at scala.pickling.json.JSONPickleReader$$anonfun$beginEntry$2.apply(JSONPickleFormat.scala:216)
  at scala.pickling.json.JSONPickleReader$$anonfun$beginEntry$2.apply(JSONPickleFormat.scala:205)
  at scala.pickling.PickleTools$class.withHints(Tools.scala:480)
  at scala.pickling.json.JSONPickleReader.withHints(JSONPickleFormat.scala:167)
  at scala.pickling.json.JSONPickleReader.beginEntry(JSONPickleFormat.scala:205)
  at scala.pickling.json.JSONPickleReader.beginEntryNoTagDebug(JSONPickleFormat.scala:204)
  at scala.pickling.json.JSONPickleReader.beginEntryNoTag(JSONPickleFormat.scala:202)
  ... 65 elided

This is on:
Scala version 2.11.6
OpenJDK Server VM, Java 1.7.0_79
Pickling version 0.9.1 (latest on maven afaik)

Am I doing something wrong or is unpickling of ValueSets just not supported?

Best,
Cornelius

@cornim cornim changed the title Can't pickle ValueSet Can't unpickle ValueSet Jul 12, 2016
@schickling
Copy link

Facing the same problem. Seems like Enumeration is not supported :(

@EdgeCaseBerg
Copy link

EdgeCaseBerg commented Aug 16, 2016

I'm using Java 8, scala 2.11.7 and also got this problem with 0.10.1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants