scala-js酸洗的基本例子

时间:2014-10-09 13:56:13

标签: scala scala-pickling

我试图了解scala-js酸洗的绝对最基本的使用方法, 但是有一些事情真的很明显。

我认为下面的内容应该有效:

package tst

import org.scalajs.spickling._
import org.scalajs.spickling.jsany._

object RH {

  case class Test(Message:String)

  PicklerRegistry.register[Test]

  def main(args: Array[String]) {
      PicklerRegistry.pickle(Test("XXX"))
  }

}

但是当我运行上述内容时,我得到一个回溯说:

Exception in thread "main" java.lang.RuntimeException: stub
at scala.sys.package$.error(package.scala:27)
at scala.scalajs.js.Any$.fromString(Primitives.scala:48)
at org.scalajs.spickling.jsany.JSPBuilder$.makeString(JSPBuilderReader.scala:10)
at org.scalajs.spickling.jsany.JSPBuilder$.makeString(JSPBuilderReader.scala:6)
at org.scalajs.spickling.Pickler$StringPickler$.pickle(Pickler.scala:58)
at org.scalajs.spickling.Pickler$StringPickler$.pickle(Pickler.scala:56)
at org.scalajs.spickling.BasePicklerRegistry.pickle(PicklerRegistry.scala:60)
at tutorial.webapp.RH$GenPickler$2$.pickle(RH.scala:10)
at tutorial.webapp.RH$GenPickler$2$.pickle(RH.scala:10)
at org.scalajs.spickling.BasePicklerRegistry.pickle(PicklerRegistry.scala:60)
at tst.RH$.main(RH.scala:13)
at tst.RH.main(RH.scala)

我在这里遗失的任何线索?

0 个答案:

没有答案