我试图了解 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)
有什么线索我在这里失踪了吗?