1

当我尝试解开一组元组时遇到问题。这是用例:

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)
4

0 回答 0