ExplicitResultTypes manually for implicit local val / def
ExplicitResultTypes scalafix rule can't fix those cases
This commit is contained in:
parent
02b9b30354
commit
fe0447d267
11 changed files with 34 additions and 32 deletions
|
|
@ -355,7 +355,7 @@ class ActorSelectionSpec extends AkkaSpec with DefaultTimeout {
|
|||
|
||||
"identify actors with wildcard selection correctly" in {
|
||||
val creator = TestProbe()
|
||||
implicit def self = creator.ref
|
||||
implicit def self: ActorRef = creator.ref
|
||||
val top = system.actorOf(p, "a")
|
||||
val b1 = Await.result((top ? Create("b1")).mapTo[ActorRef], timeout.duration)
|
||||
val b2 = Await.result((top ? Create("b2")).mapTo[ActorRef], timeout.duration)
|
||||
|
|
|
|||
|
|
@ -263,7 +263,7 @@ class ActorSystemSpec extends AkkaSpec(ActorSystemSpec.config) with ImplicitSend
|
|||
|
||||
"reliably create waves of actors" in {
|
||||
import system.dispatcher
|
||||
implicit val timeout = Timeout((20 seconds).dilated)
|
||||
implicit val timeout: Timeout = Timeout((20 seconds).dilated)
|
||||
val waves = for (_ <- 1 to 3) yield system.actorOf(Props[ActorSystemSpec.Waves]) ? 50000
|
||||
Await.result(Future.sequence(waves), timeout.duration + 5.seconds) should ===(Vector("done", "done", "done"))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ class LocalActorRefProviderSpec extends AkkaSpec(LocalActorRefProviderSpec.confi
|
|||
|
||||
for (i <- 0 until 100) {
|
||||
val address = "new-actor" + i
|
||||
implicit val timeout = Timeout(5 seconds)
|
||||
implicit val timeout: Timeout = Timeout(5 seconds)
|
||||
val actors =
|
||||
for (_ <- 1 to 4)
|
||||
yield Future(system.actorOf(Props(new Actor { def receive = { case _ => } }), address))
|
||||
|
|
|
|||
|
|
@ -496,7 +496,7 @@ class LightArrayRevolverSchedulerSpec extends AkkaSpec(SchedulerSpec.testConfRev
|
|||
|
||||
"execute multiple jobs at once when expiring multiple buckets" taggedAs TimingTest in {
|
||||
withScheduler() { (sched, driver) =>
|
||||
implicit def ec = localEC
|
||||
implicit def ec: ExecutionContext = localEC
|
||||
import driver._
|
||||
val start = step / 2
|
||||
(0 to 3).foreach(i => sched.scheduleOnce(start + step * i, testActor, "hello"))
|
||||
|
|
@ -511,7 +511,7 @@ class LightArrayRevolverSchedulerSpec extends AkkaSpec(SchedulerSpec.testConfRev
|
|||
|
||||
"properly defer jobs even when the timer thread oversleeps" taggedAs TimingTest in {
|
||||
withScheduler() { (sched, driver) =>
|
||||
implicit def ec = localEC
|
||||
implicit def ec: ExecutionContext = localEC
|
||||
import driver._
|
||||
sched.scheduleOnce(step * 3, probe.ref, "hello")
|
||||
wakeUp(step * 5)
|
||||
|
|
@ -526,7 +526,7 @@ class LightArrayRevolverSchedulerSpec extends AkkaSpec(SchedulerSpec.testConfRev
|
|||
|
||||
"correctly wrap around wheel rounds" taggedAs TimingTest in {
|
||||
withScheduler(config = ConfigFactory.parseString("akka.scheduler.ticks-per-wheel=2")) { (sched, driver) =>
|
||||
implicit def ec = localEC
|
||||
implicit def ec: ExecutionContext = localEC
|
||||
import driver._
|
||||
val start = step / 2
|
||||
(0 to 3).foreach(i => sched.scheduleOnce(start + step * i, probe.ref, "hello"))
|
||||
|
|
@ -553,7 +553,7 @@ class LightArrayRevolverSchedulerSpec extends AkkaSpec(SchedulerSpec.testConfRev
|
|||
|
||||
"correctly execute jobs when clock wraps around" taggedAs TimingTest in {
|
||||
withScheduler(Long.MaxValue - 200000000L) { (sched, driver) =>
|
||||
implicit def ec = localEC
|
||||
implicit def ec: ExecutionContext = localEC
|
||||
import driver._
|
||||
val start = step / 2
|
||||
(0 to 3).foreach(i => sched.scheduleOnce(start + step * i, testActor, "hello"))
|
||||
|
|
@ -583,7 +583,7 @@ class LightArrayRevolverSchedulerSpec extends AkkaSpec(SchedulerSpec.testConfRev
|
|||
val targetTicks = Int.MaxValue - numEvents + 20
|
||||
|
||||
withScheduler(_startTick = Int.MaxValue - 100) { (sched, driver) =>
|
||||
implicit def ec = localEC
|
||||
implicit def ec: ExecutionContext = localEC
|
||||
import driver._
|
||||
|
||||
val start = step / 2
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ package akka.dataflow
|
|||
import language.postfixOps
|
||||
|
||||
import akka.actor.{ Actor, Props }
|
||||
import akka.actor.ActorRef
|
||||
import scala.concurrent.Future
|
||||
import scala.concurrent.Await
|
||||
import scala.concurrent.duration._
|
||||
|
|
@ -25,7 +26,7 @@ class Future2ActorSpec extends AkkaSpec with DefaultTimeout {
|
|||
}
|
||||
|
||||
"support convenient sending to multiple destinations with implicit sender" in {
|
||||
implicit val someActor = system.actorOf(Props(new Actor { def receive = Actor.emptyBehavior }))
|
||||
implicit val someActor: ActorRef = system.actorOf(Props(new Actor { def receive = Actor.emptyBehavior }))
|
||||
Future(42).pipeTo(testActor).pipeTo(testActor)
|
||||
expectMsgAllOf(1 second, 42, 42)
|
||||
lastSender should ===(someActor)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class AskSpec extends AkkaSpec {
|
|||
|
||||
"The “ask” pattern" must {
|
||||
"send request to actor and wrap the answer in Future" in {
|
||||
implicit val timeout = Timeout(5.seconds)
|
||||
implicit val timeout: Timeout = Timeout(5.seconds)
|
||||
val echo = system.actorOf(Props(new Actor { def receive = { case x => sender() ! x } }))
|
||||
val f = echo ? "ping"
|
||||
f.futureValue should ===("ping")
|
||||
|
|
@ -35,7 +35,7 @@ class AskSpec extends AkkaSpec {
|
|||
}
|
||||
|
||||
"return broken promises on EmptyLocalActorRefs" in {
|
||||
implicit val timeout = Timeout(5 seconds)
|
||||
implicit val timeout: Timeout = Timeout(5 seconds)
|
||||
val empty = system.asInstanceOf[ExtendedActorSystem].provider.resolveActorRef("/user/unknown")
|
||||
val f = empty ? 3.14
|
||||
f.isCompleted should ===(true)
|
||||
|
|
@ -46,7 +46,7 @@ class AskSpec extends AkkaSpec {
|
|||
}
|
||||
|
||||
"return broken promises on unsupported ActorRefs" in {
|
||||
implicit val timeout = Timeout(5 seconds)
|
||||
implicit val timeout: Timeout = Timeout(5 seconds)
|
||||
val f = ask(null: ActorRef, 3.14)
|
||||
f.isCompleted should ===(true)
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ class AskSpec extends AkkaSpec {
|
|||
}
|
||||
|
||||
"return broken promises on 0 timeout" in {
|
||||
implicit val timeout = Timeout(0 seconds)
|
||||
implicit val timeout: Timeout = Timeout(0 seconds)
|
||||
val echo = system.actorOf(Props(new Actor { def receive = { case x => sender() ! x } }))
|
||||
val f = echo ? "foo"
|
||||
val expectedMsg =
|
||||
|
|
@ -68,7 +68,7 @@ class AskSpec extends AkkaSpec {
|
|||
}
|
||||
|
||||
"return broken promises on < 0 timeout" in {
|
||||
implicit val timeout = Timeout(-1000 seconds)
|
||||
implicit val timeout: Timeout = Timeout(-1000 seconds)
|
||||
val echo = system.actorOf(Props(new Actor { def receive = { case x => sender() ! x } }))
|
||||
val f = echo ? "foo"
|
||||
val expectedMsg =
|
||||
|
|
@ -79,7 +79,7 @@ class AskSpec extends AkkaSpec {
|
|||
}
|
||||
|
||||
"include target information in AskTimeout" in {
|
||||
implicit val timeout = Timeout(0.5 seconds)
|
||||
implicit val timeout: Timeout = Timeout(0.5 seconds)
|
||||
val silentOne = system.actorOf(Props.empty, "silent")
|
||||
val f = silentOne ? "noreply"
|
||||
intercept[AskTimeoutException] {
|
||||
|
|
@ -88,7 +88,7 @@ class AskSpec extends AkkaSpec {
|
|||
}
|
||||
|
||||
"include timeout information in AskTimeout" in {
|
||||
implicit val timeout = Timeout(0.5 seconds)
|
||||
implicit val timeout: Timeout = Timeout(0.5 seconds)
|
||||
val f = system.actorOf(Props.empty) ? "noreply"
|
||||
intercept[AskTimeoutException] {
|
||||
Await.result(f, 1 second)
|
||||
|
|
@ -96,8 +96,8 @@ class AskSpec extends AkkaSpec {
|
|||
}
|
||||
|
||||
"include sender information in AskTimeout" in {
|
||||
implicit val timeout = Timeout(0.5 seconds)
|
||||
implicit val sender = system.actorOf(Props.empty)
|
||||
implicit val timeout: Timeout = Timeout(0.5 seconds)
|
||||
implicit val sender: ActorRef = system.actorOf(Props.empty)
|
||||
val f = system.actorOf(Props.empty) ? "noreply"
|
||||
intercept[AskTimeoutException] {
|
||||
Await.result(f, 1 second)
|
||||
|
|
@ -105,7 +105,7 @@ class AskSpec extends AkkaSpec {
|
|||
}
|
||||
|
||||
"include message class information in AskTimeout" in {
|
||||
implicit val timeout = Timeout(0.5 seconds)
|
||||
implicit val timeout: Timeout = Timeout(0.5 seconds)
|
||||
val f = system.actorOf(Props.empty) ? Integer.valueOf(17)
|
||||
intercept[AskTimeoutException] {
|
||||
Await.result(f, 1 second)
|
||||
|
|
@ -113,7 +113,7 @@ class AskSpec extends AkkaSpec {
|
|||
}
|
||||
|
||||
"work for ActorSelection" in {
|
||||
implicit val timeout = Timeout(5 seconds)
|
||||
implicit val timeout: Timeout = Timeout(5 seconds)
|
||||
import system.dispatcher
|
||||
val echo = system.actorOf(Props(new Actor { def receive = { case x => sender() ! x } }), "select-echo")
|
||||
val identityFuture =
|
||||
|
|
@ -123,7 +123,7 @@ class AskSpec extends AkkaSpec {
|
|||
}
|
||||
|
||||
"work when reply uses actor selection" in {
|
||||
implicit val timeout = Timeout(5 seconds)
|
||||
implicit val timeout: Timeout = Timeout(5 seconds)
|
||||
val deadListener = TestProbe()
|
||||
system.eventStream.subscribe(deadListener.ref, classOf[DeadLetter])
|
||||
|
||||
|
|
@ -138,7 +138,7 @@ class AskSpec extends AkkaSpec {
|
|||
}
|
||||
|
||||
"throw AskTimeoutException on using *" in {
|
||||
implicit val timeout = Timeout(0.5 seconds)
|
||||
implicit val timeout: Timeout = Timeout(0.5 seconds)
|
||||
val deadListener = TestProbe()
|
||||
system.eventStream.subscribe(deadListener.ref, classOf[DeadLetter])
|
||||
|
||||
|
|
@ -154,7 +154,7 @@ class AskSpec extends AkkaSpec {
|
|||
}
|
||||
|
||||
"throw AskTimeoutException on using .." in {
|
||||
implicit val timeout = Timeout(0.5 seconds)
|
||||
implicit val timeout: Timeout = Timeout(0.5 seconds)
|
||||
val deadListener = TestProbe()
|
||||
system.eventStream.subscribe(deadListener.ref, classOf[DeadLetter])
|
||||
|
||||
|
|
@ -175,7 +175,7 @@ class AskSpec extends AkkaSpec {
|
|||
}
|
||||
|
||||
"send to DeadLetter when child does not exist" in {
|
||||
implicit val timeout = Timeout(0.5 seconds)
|
||||
implicit val timeout: Timeout = Timeout(0.5 seconds)
|
||||
val deadListener = TestProbe()
|
||||
system.eventStream.subscribe(deadListener.ref, classOf[DeadLetter])
|
||||
|
||||
|
|
@ -194,7 +194,7 @@ class AskSpec extends AkkaSpec {
|
|||
}
|
||||
|
||||
"send DeadLetter when answering to grandchild" in {
|
||||
implicit val timeout = Timeout(0.5 seconds)
|
||||
implicit val timeout: Timeout = Timeout(0.5 seconds)
|
||||
val deadListener = TestProbe()
|
||||
system.eventStream.subscribe(deadListener.ref, classOf[DeadLetter])
|
||||
|
||||
|
|
@ -212,7 +212,7 @@ class AskSpec extends AkkaSpec {
|
|||
}
|
||||
|
||||
"allow watching the promiseActor and send Terminated() when completes" in {
|
||||
implicit val timeout = Timeout(300 millis)
|
||||
implicit val timeout: Timeout = Timeout(300 millis)
|
||||
val p = TestProbe()
|
||||
|
||||
val act = system.actorOf(Props(new Actor {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class ExplicitAskSpec extends AkkaSpec {
|
|||
|
||||
"The “ask” pattern with explicit sender" must {
|
||||
"allow to access an explicit reference to actor to respond to" in {
|
||||
implicit val timeout = Timeout(5.seconds)
|
||||
implicit val timeout: Timeout = Timeout(5.seconds)
|
||||
|
||||
val target = system.actorOf(Props(new Actor {
|
||||
def receive = {
|
||||
|
|
@ -32,7 +32,7 @@ class ExplicitAskSpec extends AkkaSpec {
|
|||
}
|
||||
|
||||
"work for ActorSelection" in {
|
||||
implicit val timeout = Timeout(5.seconds)
|
||||
implicit val timeout: Timeout = Timeout(5.seconds)
|
||||
|
||||
val target = system.actorOf(Props(new Actor {
|
||||
def receive = {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class SpawnProtocolSpec extends ScalaTestWithActorTestKit with AnyWordSpecLike w
|
|||
"have nice API for ask" in {
|
||||
val parent = spawn(SpawnProtocol(), "parent2")
|
||||
import akka.actor.typed.scaladsl.AskPattern._
|
||||
implicit val timeout = Timeout(5.seconds)
|
||||
implicit val timeout: Timeout = Timeout(5.seconds)
|
||||
val parentReply: Future[ActorRef[Ping]] =
|
||||
parent.ask(SpawnProtocol.Spawn(target, "child", Props.empty, _))
|
||||
val child = parentReply.futureValue
|
||||
|
|
|
|||
|
|
@ -428,7 +428,7 @@ object StyleGuideDocExamples {
|
|||
import akka.actor.typed.scaladsl.AskPattern._
|
||||
import akka.util.Timeout
|
||||
|
||||
implicit val timeout = Timeout(3.seconds)
|
||||
implicit val timeout: Timeout = Timeout(3.seconds)
|
||||
val counter: ActorRef[Command] = ???
|
||||
|
||||
val result: Future[OperationResult] = counter.ask(replyTo => Increment(delta = 2, replyTo))
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import scala.collection.immutable
|
|||
import scala.concurrent.Await
|
||||
import scala.language.existentials
|
||||
import scala.util.control.{ NoStackTrace, NonFatal }
|
||||
import akka.util.Timeout
|
||||
|
||||
/**
|
||||
* This trait brings log level handling to the EventStream: it reads the log
|
||||
|
|
@ -198,7 +199,7 @@ trait LoggingBus extends ActorEventBus {
|
|||
logName: String): ActorRef = {
|
||||
val name = "log" + LogExt(system).id() + "-" + simpleName(clazz)
|
||||
val actor = system.systemActorOf(Props(clazz).withDispatcher(system.settings.LoggersDispatcher), name)
|
||||
implicit def timeout = system.settings.LoggerStartTimeout
|
||||
implicit def timeout: Timeout = system.settings.LoggerStartTimeout
|
||||
import akka.pattern.ask
|
||||
val response = try Await.result(actor ? InitializeLogger(this), timeout.duration)
|
||||
catch {
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ object AkkaBuild {
|
|||
|implicit def _system = system
|
||||
|def startSystem(remoting: Boolean = false) { system = ActorSystem("repl", if(remoting) remoteConfig else config); println("don’t forget to system.terminate()!") }
|
||||
|implicit def ec = system.dispatcher
|
||||
|implicit val timeout = Timeout(5 seconds)
|
||||
|implicit val timeout: Timeout = Timeout(5 seconds)
|
||||
|""".stripMargin,
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue