Open lihaoyi opened 10 years ago
That revision is on 0.8.0
, but I just reproduced on 0.9.0-SNAPSHOT
I am receiving this error as well.
[error] scala.ScalaReflectionException: type T is not a class
[error] at scala.reflect.api.Symbols$SymbolApi$class.asClass(Symbols.scala:275)
[error] at scala.reflect.internal.Symbols$SymbolContextApiImpl.asClass(Symbols.scala:84)
[error] at upickle.Macros$.picklerFor(Macros.scala:75)
[error] at upickle.Macros$.macroRImpl(Macros.scala:35)
[error] upickle.read[T](d)
I am attempting to write a responder using the following syntax...
socket.addResponder[List[Auth.SurfKitUser]]("Auth","friends"){
f =>
println(s"friends.. $f")
}
The add responder stores the method and deserializes to the type expected for the callback
def addResponder[T >: upickle.Types](module:String, op:String)(responder:(T) => Unit) = {
val key = s"$module-$op"
def hook(d:String):Unit = {
Try {
upickle.read[T](d)
} match{
case Success(data) => responder(data)
case Failure(e) =>
println(s"Responder Failed to serialize to type..")
println(s"${e}")
}
}
val list:List[(String) => Unit] = hook _ :: responders.get(key).getOrElse(List[(String) => Unit]())
responders += (key -> list)
}
Any idea why this is failing? I am greatfull for any guidance you can provide :)
Clone this particular revision
https://github.com/lihaoyi/autowire/commit/5fc3066aef81fbe62939505bcdaf0e37740c3c4a#diff-826e9a6ed74accfd3512bcd6279d3bc7R109
And hit
sbt jvm/test
to repro.I have no idea why it's blowing up; all I know is that it is ^_^