Unpickler for Array of tuple

时间:2013-10-17 13:20:40

标签: scala-pickling

当我尝试取消一系列元组时,我遇到了问题。以下是用例:

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

以上在unpickling时会产生运行时异常。

提前感谢您的帮助。

以下是我得到的例外情况:

Exception in thread "main" scala.reflect.internal.MissingRequirementError: class scala.Tuple2[java.lang.String in JavaMirror with...
at scala.reflect.internal.MissingRequirementError$.signal(MissingRequirementError.scala:16) 
at scala.reflect.internal.MissingRequirementError$.notFound(MissingRequirementError.scala:17)
at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:48)
at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:61)
at scala.reflect.internal.Mirrors$RootsBase.staticModuleOrClass(Mirrors.scala:72)
at scala.reflect.internal.Mirrors$RootsBase.staticClass(Mirrors.scala:119)
at scala.reflect.internal.Mirrors$RootsBase.staticClass(Mirrors.scala:21)
at scala.pickling.internal.package$.typeFromString(package.scala:61)
at scala.pickling.internal.package$$anonfun$2.apply(package.scala:63)
at scala.pickling.internal.package$$anonfun$2.apply(package.scala:63)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.immutable.List.foreach(List.scala:318)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
at scala.collection.AbstractTraversable.map(Traversable.scala:105)
at scala.pickling.internal.package$.typeFromString(package.scala:63)
at scala.pickling.FastTypeTag$.apply(FastTags.scala:57)

0 个答案:

没有答案