Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update scalafmt-core to 3.8.4 #1717

Merged
merged 4 commits into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,6 @@ c44c0b7cbdab11d85176cfe062288fdcba16c56a

# Scala Steward: Reformat with scalafmt 3.8.2
38b03829b4e38e983521f3efd7e589d315658f18

# Scala Steward: Reformat with scalafmt 3.8.4
f48453e60a8d11f74acc7a10d3a9da90b8acd4af
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 3.8.3
version = 3.8.4
runner.dialect = scala213
project.git = true
style = defaultWithAlign
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ package org.apache.pekko.actor

import scala.concurrent.duration._

import language.postfixOps
import org.scalatest.BeforeAndAfterEach

import org.apache.pekko
Expand Down Expand Up @@ -79,7 +78,7 @@ class ActorConfigurationVerificationSpec
"fail verification with a ConfigurationException if also configured with a ScatterGatherFirstCompletedPool" in {
intercept[ConfigurationException] {
system.actorOf(
ScatterGatherFirstCompletedPool(nrOfInstances = 2, within = 2 seconds)
ScatterGatherFirstCompletedPool(nrOfInstances = 2, within = 2.seconds)
.withDispatcher("balancing-dispatcher")
.props(Props[TestActor]()))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
package org.apache.pekko.actor

import scala.concurrent.duration._
import scala.language.postfixOps

import com.codahale.metrics.Histogram
import com.typesafe.config.ConfigFactory
Expand Down Expand Up @@ -153,10 +152,10 @@ class ActorCreationPerfSpec
expectMsg(Alive)

driver ! Create(number, propsCreator)
expectMsgPF(15 seconds, s"$scenarioName waiting for Created") { case Created => }
expectMsgPF(15.seconds, s"$scenarioName waiting for Created") { case Created => }

driver ! WaitForChildren
expectMsgPF(15 seconds, s"$scenarioName waiting for Waited") { case Waited => }
expectMsgPF(15.seconds, s"$scenarioName waiting for Waited") { case Waited => }

driver ! PoisonPill
watch(driver)
Expand All @@ -175,10 +174,10 @@ class ActorCreationPerfSpec
val before = mem.getHeapSnapshot

driver ! Create(number, propsCreator)
expectMsgPF(15 seconds, s"$scenarioName waiting for Created") { case Created => }
expectMsgPF(15.seconds, s"$scenarioName waiting for Created") { case Created => }

driver ! WaitForChildren
expectMsgPF(15 seconds, s"$scenarioName waiting for Waited") { case Waited => }
expectMsgPF(15.seconds, s"$scenarioName waiting for Waited") { case Waited => }

gc()
val after = mem.getHeapSnapshot
Expand Down Expand Up @@ -252,5 +251,5 @@ class ActorCreationPerfSpec

override def afterTermination() = shutdownMetrics()

override def expectedTestDuration = 5 minutes
override def expectedTestDuration = 5.minutes
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import scala.concurrent.Await
import scala.concurrent.Promise
import scala.concurrent.duration._

import language.postfixOps

import org.apache.pekko
import pekko.pattern.ask
import pekko.serialization.JavaSerializer
Expand Down Expand Up @@ -141,7 +139,7 @@ class ActorRefSpec extends PekkoSpec("""
def wrap[T](f: Promise[Actor] => T): T = {
val result = Promise[Actor]()
val r = f(result)
Await.result(result.future, 1 minute)
Await.result(result.future, 1.minute)
r
}

Expand Down Expand Up @@ -448,7 +446,7 @@ class ActorRefSpec extends PekkoSpec("""
val boss = system.actorOf(Props(new Actor {

override val supervisorStrategy =
OneForOneStrategy(maxNrOfRetries = 2, withinTimeRange = 1 second)(List(classOf[Throwable]))
OneForOneStrategy(maxNrOfRetries = 2, withinTimeRange = 1.second)(List(classOf[Throwable]))

val ref = context.actorOf(Props(new Actor {
def receive = { case _ => }
Expand All @@ -460,7 +458,7 @@ class ActorRefSpec extends PekkoSpec("""
}))

boss ! "sendKill"
Await.ready(latch, 5 seconds)
Await.ready(latch, 5.seconds)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import java.util.concurrent.atomic.AtomicInteger

import scala.concurrent.{ Await, Future }
import scala.concurrent.duration._
import scala.language.postfixOps

import scala.annotation.nowarn
import com.typesafe.config.{ Config, ConfigFactory }
Expand Down Expand Up @@ -224,7 +223,7 @@ class ActorSystemSpec extends PekkoSpec(ActorSystemSpec.config) with ImplicitSen
}

system2.terminate()
Await.ready(latch, 5 seconds)
Await.ready(latch, 5.seconds)

val expected = (for (i <- 1 to count) yield i).reverse

Expand All @@ -243,7 +242,7 @@ class ActorSystemSpec extends PekkoSpec(ActorSystemSpec.config) with ImplicitSen
import system.dispatcher
system2.scheduler.scheduleOnce(200.millis.dilated) { system2.terminate() }

Await.ready(system2.whenTerminated, 5 seconds)
Await.ready(system2.whenTerminated, 5.seconds)
callbackWasRun should ===(true)
}

Expand All @@ -252,17 +251,17 @@ class ActorSystemSpec extends PekkoSpec(ActorSystemSpec.config) with ImplicitSen
val wt = system.whenTerminated
wt.isCompleted should ===(false)
val f = system.terminate()
val terminated = Await.result(wt, 10 seconds)
val terminated = Await.result(wt, 10.seconds)
system.whenTerminated.isCompleted should ===(true)
terminated.actor should ===(system.provider.rootGuardian)
terminated.addressTerminated should ===(true)
terminated.existenceConfirmed should ===(true)
(terminated should be).theSameInstanceAs(Await.result(f, 10 seconds))
(terminated should be).theSameInstanceAs(Await.result(f, 10.seconds))
}

"throw RejectedExecutionException when shutdown" in {
val system2 = ActorSystem("RejectedExecution-1", PekkoSpec.testConf)
Await.ready(system2.terminate(), 10 seconds)
Await.ready(system2.terminate(), 10.seconds)

intercept[RejectedExecutionException] {
system2.registerOnTermination { println("IF YOU SEE THIS THEN THERE'S A BUG HERE") }
Expand All @@ -287,7 +286,7 @@ class ActorSystemSpec extends PekkoSpec(ActorSystemSpec.config) with ImplicitSen

"reliably create waves of actors" in {
import system.dispatcher
implicit val timeout: 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"))
}
Expand All @@ -300,7 +299,7 @@ class ActorSystemSpec extends PekkoSpec(ActorSystemSpec.config) with ImplicitSen
"reliable deny creation of actors while shutting down" in {
val system = ActorSystem()
import system.dispatcher
system.scheduler.scheduleOnce(100 millis) { system.terminate() }
system.scheduler.scheduleOnce(100.millis) { system.terminate() }
var failing = false
var created = Vector.empty[ActorRef]
while (!system.whenTerminated.isCompleted) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package org.apache.pekko.actor
import scala.concurrent.duration._

import com.typesafe.config.{ Config, ConfigFactory }
import language.postfixOps
import org.scalatest.BeforeAndAfterEach

import org.apache.pekko
Expand Down Expand Up @@ -67,9 +66,9 @@ object ActorWithBoundedStashSpec {
}

// bounded deque-based mailbox with capacity 10
class Bounded10(@unused settings: Settings, @unused config: Config) extends BoundedDequeBasedMailbox(10, 500 millis)
class Bounded10(@unused settings: Settings, @unused config: Config) extends BoundedDequeBasedMailbox(10, 500.millis)

class Bounded100(@unused settings: Settings, @unused config: Config) extends BoundedDequeBasedMailbox(100, 500 millis)
class Bounded100(@unused settings: Settings, @unused config: Config) extends BoundedDequeBasedMailbox(100, 500.millis)

val dispatcherId1 = "my-dispatcher-1"
val dispatcherId2 = "my-dispatcher-2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import scala.concurrent.Await
import scala.concurrent.duration._

import scala.annotation.nowarn
import language.postfixOps
import org.scalatest.BeforeAndAfterEach

import org.apache.pekko
Expand Down Expand Up @@ -144,13 +143,13 @@ class ActorWithStashSpec extends PekkoSpec with DefaultTimeout with BeforeAndAft
val stasher = system.actorOf(Props[StashingTwiceActor]())
stasher ! "hello"
stasher ! "hello"
Await.ready(state.expectedException, 10 seconds)
Await.ready(state.expectedException, 10.seconds)
}

"process stashed messages after restart" in {
val boss = system.actorOf(
Props(
new Supervisor(OneForOneStrategy(maxNrOfRetries = 2, withinTimeRange = 1 second)(List(classOf[Throwable])))))
new Supervisor(OneForOneStrategy(maxNrOfRetries = 2, withinTimeRange = 1.second)(List(classOf[Throwable])))))

val restartLatch = new TestLatch
val hasMsgLatch = new TestLatch
Expand Down Expand Up @@ -180,8 +179,8 @@ class ActorWithStashSpec extends PekkoSpec with DefaultTimeout with BeforeAndAft
employee ! "hello"
employee ! "crash"

Await.ready(restartLatch, 10 seconds)
Await.ready(hasMsgLatch, 10 seconds)
Await.ready(restartLatch, 10.seconds)
Await.ready(hasMsgLatch, 10.seconds)
}

"re-receive unstashed Terminated messages" in {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ package org.apache.pekko.actor

import scala.concurrent.duration._

import language.postfixOps

import org.apache.pekko
import pekko.dispatch.ThreadPoolConfig
import pekko.testkit.PekkoSpec
Expand Down Expand Up @@ -80,7 +78,7 @@ class ConsistencySpec extends PekkoSpec(ConsistencySpec.config) {

for (a <- actors) { a.tell("done", testActor) }

for (_ <- actors) expectMsg(5 minutes, "done")
for (_ <- actors) expectMsg(5.minutes, "done")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import scala.concurrent.Await
import scala.concurrent.duration._

import scala.annotation.nowarn
import language.postfixOps

import org.apache.pekko
import pekko.actor.Props.EmptyActor
Expand Down Expand Up @@ -125,11 +124,11 @@ trait DeathWatchSpec { this: PekkoSpec with ImplicitSender with DefaultTimeout =
lazy val supervisor = system.actorOf(Props(classOf[Supervisor], SupervisorStrategy.defaultStrategy), "watchers")

def startWatching(target: ActorRef) =
Await.result((supervisor ? Watcher.props(target, testActor)).mapTo[ActorRef], 3 seconds)
Await.result((supervisor ? Watcher.props(target, testActor)).mapTo[ActorRef], 3.seconds)

"The Death Watch" must {
def expectTerminationOf(actorRef: ActorRef) =
expectMsgPF(5 seconds, "" + actorRef + ": Stopped or Already terminated when linking") {
expectMsgPF(5.seconds, "" + actorRef + ": Stopped or Already terminated when linking") {
case WrappedTerminated(Terminated(`actorRef`)) => true
}

Expand Down Expand Up @@ -236,7 +235,7 @@ trait DeathWatchSpec { this: PekkoSpec with ImplicitSender with DefaultTimeout =
startWatching(brother)

failed ! Kill
val result = receiveWhile(3 seconds, messages = 3) {
val result = receiveWhile(3.seconds, messages = 3) {
case FF(Failed(_, _: ActorKilledException, _)) if lastSender eq failed => 1
case FF(Failed(_, DeathPactException(`failed`), _)) if lastSender eq brother => 2
case WrappedTerminated(Terminated(`brother`)) => 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import scala.concurrent.duration._

import com.typesafe.config.ConfigFactory
import com.typesafe.config.ConfigParseOptions
import language.postfixOps

import org.apache.pekko
import pekko.routing._
Expand Down Expand Up @@ -201,7 +200,7 @@ class DeployerSpec extends PekkoSpec(DeployerSpec.deployerConf) {
"be able to parse 'pekko.actor.deployment._' with scatter-gather router" in {
assertRouting(
"/service-scatter-gather",
ScatterGatherFirstCompletedPool(nrOfInstances = 1, within = 2 seconds),
ScatterGatherFirstCompletedPool(nrOfInstances = 1, within = 2.seconds),
"/service-scatter-gather")
}

Expand All @@ -218,7 +217,7 @@ class DeployerSpec extends PekkoSpec(DeployerSpec.deployerConf) {
assertRouting("/some/wildcardmatch", RandomPool(1), "/some/*")
assertRouting(
"/somewildcardmatch/some",
ScatterGatherFirstCompletedPool(nrOfInstances = 1, within = 2 seconds),
ScatterGatherFirstCompletedPool(nrOfInstances = 1, within = 2.seconds),
"/*/some")
}

Expand Down
Loading
Loading