scala - non-variable type argument akka.actor.ActorRef -


here code involving akka:

def receive = {    case idlist: list[actorref] => idlist.foreach(x => x ! msg) } 

sbt complains that:

non-variable type argument akka.actor.actorref in type pattern list[akka.actor.actorref] unchecked since eliminated erasure [warn]     case idlist: list[actorref] => idlist.foreach(x => x ! msg) 

how rid of this?

at runtime list[whatever] equivalent list[any], actor can figure out received list not it's list of actorrefs. jvm thing , not scala's or akka's fault.

you have 2 choices:

1) ignore replacing actorref _

case idlist: list[_] => ... 

2) wrap datastructure (recommended)

case class ids(idlist: list[actorref]) 

the second choice let's check against ids without having check parametric type of list.

def receive = {    case ids(idlist) => idlist.foreach(x => x ! msg) } 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -