diff --git a/akka-actor/src/main/scala/akka/actor/Deployer.scala b/akka-actor/src/main/scala/akka/actor/Deployer.scala index 30118ae03a..255fe082c4 100644 --- a/akka-actor/src/main/scala/akka/actor/Deployer.scala +++ b/akka-actor/src/main/scala/akka/actor/Deployer.scala @@ -139,7 +139,7 @@ private[akka] class Deployer(val settings: ActorSystem.Settings, val dynamicAcce val deployment = config.withFallback(default) - val routees = deployment.getStringList("routees.paths").asScala.toSeq + val routees = Vector() ++ deployment.getStringList("routees.paths").asScala val nrOfInstances = deployment.getInt("nr-of-instances") diff --git a/akka-remote/src/main/scala/akka/remote/MessageSerializer.scala b/akka-remote/src/main/scala/akka/remote/MessageSerializer.scala index 6bd61dd812..b2413da3f9 100644 --- a/akka-remote/src/main/scala/akka/remote/MessageSerializer.scala +++ b/akka-remote/src/main/scala/akka/remote/MessageSerializer.scala @@ -4,6 +4,8 @@ package akka.remote +import language.existentials + import akka.remote.RemoteProtocol._ import com.google.protobuf.ByteString import akka.actor.ExtendedActorSystem diff --git a/akka-remote/src/main/scala/akka/remote/RemoteDeployer.scala b/akka-remote/src/main/scala/akka/remote/RemoteDeployer.scala index 58a3b8452d..f5589b3f72 100644 --- a/akka-remote/src/main/scala/akka/remote/RemoteDeployer.scala +++ b/akka-remote/src/main/scala/akka/remote/RemoteDeployer.scala @@ -22,7 +22,7 @@ private[akka] class RemoteDeployer(_settings: ActorSystem.Settings, _pm: Dynamic case AddressFromURIString(r) ⇒ Some(deploy.copy(scope = RemoteScope(r))) case str ⇒ if (!str.isEmpty) throw new ConfigurationException("unparseable remote node name " + str) - val nodes = deploy.config.getStringList("target.nodes").asScala map (AddressFromURIString(_)) + val nodes = deploy.config.getStringList("target.nodes").asScala.toIndexedSeq map (AddressFromURIString(_)) if (nodes.isEmpty || deploy.routerConfig == NoRouter) d else Some(deploy.copy(routerConfig = RemoteRouterConfig(deploy.routerConfig, nodes))) } diff --git a/akka-remote/src/main/scala/akka/remote/RemoteTransport.scala b/akka-remote/src/main/scala/akka/remote/RemoteTransport.scala index c48cc430f2..df76fe58a5 100644 --- a/akka-remote/src/main/scala/akka/remote/RemoteTransport.scala +++ b/akka-remote/src/main/scala/akka/remote/RemoteTransport.scala @@ -34,7 +34,7 @@ case class RemoteClientError( @transient @BeanProperty remote: RemoteTransport, @BeanProperty remoteAddress: Address) extends RemoteClientLifeCycleEvent { override def logLevel: Logging.LogLevel = Logging.ErrorLevel - override def toString: String = "RemoteClientError@" + remoteAddress + ": Error[" + cause + "]" + override def toString: String = "RemoteClientError@" + remoteAddress + ": Error[" + Logging.stackTraceFor(cause) + "]" } /** diff --git a/akka-remote/src/main/scala/akka/serialization/DaemonMsgCreateSerializer.scala b/akka-remote/src/main/scala/akka/serialization/DaemonMsgCreateSerializer.scala index 414fdecc1f..8f25021253 100644 --- a/akka-remote/src/main/scala/akka/serialization/DaemonMsgCreateSerializer.scala +++ b/akka-remote/src/main/scala/akka/serialization/DaemonMsgCreateSerializer.scala @@ -6,23 +6,13 @@ package akka.serialization import java.io.Serializable import com.google.protobuf.ByteString -import com.typesafe.config.Config -import com.typesafe.config.ConfigFactory -import akka.actor.Actor -import akka.actor.ActorRef -import akka.actor.Deploy -import akka.actor.ExtendedActorSystem -import akka.actor.NoScopeGiven -import akka.actor.Props -import akka.actor.Scope +import com.typesafe.config.{ Config, ConfigFactory } +import akka.actor.{ Actor, ActorRef, Deploy, ExtendedActorSystem, NoScopeGiven, Props, Scope } import akka.remote.DaemonMsgCreate -import akka.remote.RemoteProtocol.ActorRefProtocol -import akka.remote.RemoteProtocol.DaemonMsgCreateProtocol -import akka.remote.RemoteProtocol.DeployProtocol -import akka.remote.RemoteProtocol.PropsProtocol -import akka.routing.NoRouter -import akka.routing.RouterConfig +import akka.remote.RemoteProtocol.{ DaemonMsgCreateProtocol, DeployProtocol, PropsProtocol } +import akka.routing.{ NoRouter, RouterConfig } import akka.actor.FromClassCreator +import scala.reflect.ClassTag /** * Serializes akka's internal DaemonMsgCreate using protobuf @@ -99,7 +89,7 @@ private[akka] class DaemonMsgCreateSerializer(val system: ExtendedActorSystem) e def props = { val creator = if (proto.getProps.hasFromClassCreator) { - system.dynamicAccess.getClassFor(proto.getProps.getFromClassCreator) match { + system.dynamicAccess.getClassFor[Actor](proto.getProps.getFromClassCreator) match { case Right(clazz) ⇒ FromClassCreator(clazz) case Left(e) ⇒ throw e } @@ -134,9 +124,8 @@ private[akka] class DaemonMsgCreateSerializer(val system: ExtendedActorSystem) e protected def deserialize[T: ClassTag](data: ByteString, clazz: Class[T]): T = { val bytes = data.toByteArray serialization.deserialize(bytes, clazz) match { - case Right(x) if classManifest[T].erasure.isInstance(x) ⇒ x.asInstanceOf[T] - case Right(other) ⇒ throw new IllegalArgumentException("Can't deserialize to [%s], got [%s]". - format(clazz.getName, other)) + case Right(x: T) ⇒ x + case Right(other) ⇒ throw new IllegalArgumentException("Can't deserialize to [%s], got [%s]".format(clazz.getName, other)) case Left(e) ⇒ // Fallback to the java serializer, because some interfaces don't implement java.io.Serializable, // but the impl instance does. This could be optimized by adding java serializers in reference.conf: @@ -144,8 +133,8 @@ private[akka] class DaemonMsgCreateSerializer(val system: ExtendedActorSystem) e // akka.routing.RouterConfig // akka.actor.Scope serialization.deserialize(bytes, classOf[java.io.Serializable]) match { - case Right(x) if classManifest[T].erasure.isInstance(x) ⇒ x.asInstanceOf[T] - case _ ⇒ throw e // the first exception + case Right(x: T) ⇒ x + case _ ⇒ throw e // the first exception } } } diff --git a/akka-remote/src/test/scala/akka/remote/RemoteConfigSpec.scala b/akka-remote/src/test/scala/akka/remote/RemoteConfigSpec.scala index 8ac11e2440..3ec52e2243 100644 --- a/akka-remote/src/test/scala/akka/remote/RemoteConfigSpec.scala +++ b/akka-remote/src/test/scala/akka/remote/RemoteConfigSpec.scala @@ -3,6 +3,8 @@ */ package akka.remote +import language.postfixOps + import akka.testkit.AkkaSpec import akka.actor.ExtendedActorSystem import akka.util.duration._ diff --git a/akka-remote/src/test/scala/akka/remote/Ticket1978CommunicationSpec.scala b/akka-remote/src/test/scala/akka/remote/Ticket1978CommunicationSpec.scala index 64408f15b1..eef85df3ea 100644 --- a/akka-remote/src/test/scala/akka/remote/Ticket1978CommunicationSpec.scala +++ b/akka-remote/src/test/scala/akka/remote/Ticket1978CommunicationSpec.scala @@ -3,6 +3,8 @@ */ package akka.remote +import language.postfixOps + import akka.testkit._ import akka.actor._ import com.typesafe.config._ diff --git a/akka-remote/src/test/scala/akka/serialization/DaemonMsgCreateSerializerSpec.scala b/akka-remote/src/test/scala/akka/serialization/DaemonMsgCreateSerializerSpec.scala index e38a3e1d1f..e7ff53bc9f 100644 --- a/akka-remote/src/test/scala/akka/serialization/DaemonMsgCreateSerializerSpec.scala +++ b/akka-remote/src/test/scala/akka/serialization/DaemonMsgCreateSerializerSpec.scala @@ -4,20 +4,14 @@ package akka.serialization +import language.postfixOps + import com.typesafe.config.ConfigFactory import akka.testkit.AkkaSpec -import akka.actor.Actor -import akka.actor.Address -import akka.actor.Props -import akka.actor.Deploy -import akka.actor.OneForOneStrategy -import akka.actor.SupervisorStrategy -import akka.remote.DaemonMsgCreate -import akka.remote.RemoteScope -import akka.routing.RoundRobinRouter -import akka.routing.FromConfig +import akka.actor.{ Actor, Address, Props, Deploy, OneForOneStrategy, SupervisorStrategy, FromClassCreator } +import akka.remote.{ DaemonMsgCreate, RemoteScope } +import akka.routing.{ RoundRobinRouter, FromConfig } import akka.util.duration._ -import akka.actor.FromClassCreator object DaemonMsgCreateSerializerSpec { class MyActor extends Actor { @@ -92,6 +86,7 @@ class DaemonMsgCreateSerializerSpec extends AkkaSpec { ser.deserialize(bytes.asInstanceOf[Array[Byte]], classOf[DaemonMsgCreate]) match { case Left(exception) ⇒ fail(exception) case Right(m: DaemonMsgCreate) ⇒ assertDaemonMsgCreate(msg, m) + case other ⇒ throw new MatchError(other) } }