I am trying to compile an Actor with DynamicMessage with Scala Reflection Toolbox
The actor code looks like
import scala.reflect.runtime.universe
import scala.tools.reflect.ToolBox
val toolbox = universe.runtimeMirror(getClass.getClassLoader).mkToolBox()
val actorCode =
"""
|import akka.actor._
|import com.google.protobuf._
|class SimpleActor extends Actor {
|override def receive: Receive = {
| case dynamicMessage: DynamicMessage => println("Dynamic message received!")
| case _ => println("Whatever!") // the default, catch-all
| }
|}
|object SimpleActor {
|def props() : Props = Props(new SimpleActor())
|}
|
|
|return SimpleActor.props()
|""".stripMargin
val tree = toolbox.parse(actorCode)
toolbox.compile(tree)().asInstanceOf[Props]
I get the error
reflective compilation has failed:
illegal cyclic reference involving type T
scala.tools.reflect.ToolBoxError: reflective compilation has failed:
illegal cyclic reference involving type T
If I run the code outside of the Toolbox it compiles and works fine. The error is given from the line
case dynamicMessage: DynamicMessage => println("Dynamic message received!")
Anyone knows the nature of this error and how to fix it?
Buy ford edge titanium for sale
RépondreSupprimerBuy ford edge titanium mens titanium wedding rings for sale in Canada for where can i buy titanium trim big discounts on many items. Huge microtouch titanium collection of vintage trekz titanium headphones electronics, ray ban titanium electronics and more.