title: call methods on akka actors in scala
body: <p>I have a an actor defined as so:</p>
  
  <pre><code>class nodeActor(ID: String) extends Actor
  </code></pre>
  
  <p>which contains a method, which is used to set up the actor before it is started:</p>
  
  <pre><code>def addRef(actor:ActorRef)
  </code></pre>
  
  <p>I instantiate this actor as so:</p>
  
  <pre><code>val node1 = system.actorOf(Props(new nodeActor("node1")), name="node1")
  </code></pre>
  
  <p>which returns me an ActorRef. The compiler doesn't let me call "addRef" on an ActorRef since it's a member of the subtype. So I cast the node using:</p>
  
  <pre><code>node1.asInstanceOf[nodeActor].addRef(link1)
  </code></pre>
  
  <p>Which keeps the compiler happy. Then at runtime I get</p>
  
  <pre><code>java.lang.ClassCastException: akka.actor.LocalActorRef cannot be cast to ActorStressTest.nodeActor
  </code></pre>
  
  <p>which doesn't even seem to make sense to me since it's a subtype and I should be able to cast to it.</p>
  
  <p>Ideas?</p>