Skip to content
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 11 additions & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version = 3.11.1
runner.dialect = scala213
runner.dialect = scala213source3
project.git = true
style = defaultWithAlign
docstrings.style = Asterisk
Expand Down Expand Up @@ -76,3 +76,13 @@ project.excludeFilters = [
"scripts/authors.scala"
]
project.layout = StandardConvention

rewrite.scala3.convertToNewSyntax = true
runner {
dialectOverride {
allowSignificantIndentation = false
allowAsForImportRename = false
allowStarWildcardImport = false
allowPostfixStarVarargSplices = false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ object Effect {
with Serializable {

override def equals(other: Any) = other match {
case o: Spawned[_] =>
case o: Spawned[?] =>
this.behavior == o.behavior &&
this.childName == o.childName &&
this.props == o.props
Expand All @@ -113,7 +113,7 @@ object Effect {
override def _1: Behavior[T] = behavior
override def _2: String = childName
override def _3: Props = props
override def canEqual(o: Any) = o.isInstanceOf[Spawned[_]]
override def canEqual(o: Any) = o.isInstanceOf[Spawned[?]]
}

object Spawned {
Expand All @@ -131,7 +131,7 @@ object Effect {
with Serializable {

override def equals(other: Any) = other match {
case o: SpawnedAnonymous[_] => this.behavior == o.behavior && this.props == o.props
case o: SpawnedAnonymous[?] => this.behavior == o.behavior && this.props == o.props
case _ => false
}
override def hashCode: Int = behavior.## * 31 + props.##
Expand All @@ -140,7 +140,7 @@ object Effect {
override def productPrefix = "SpawnedAnonymous"
override def _1: Behavior[T] = behavior
override def _2: Props = props
override def canEqual(o: Any) = o.isInstanceOf[SpawnedAnonymous[_]]
override def canEqual(o: Any) = o.isInstanceOf[SpawnedAnonymous[?]]
}

object SpawnedAnonymous {
Expand All @@ -160,15 +160,15 @@ object Effect {
with Serializable {

override def equals(other: Any) = other match {
case o: SpawnedAdapter[_] => this.name == o.name
case o: SpawnedAdapter[?] => this.name == o.name
case _ => false
}
override def hashCode: Int = name.##
override def toString: String = s"SpawnedAdapter($name)"

override def productPrefix = "SpawnedAdapter"
override def _1: String = name
override def canEqual(o: Any) = o.isInstanceOf[SpawnedAdapter[_]]
override def canEqual(o: Any) = o.isInstanceOf[SpawnedAdapter[?]]
}

/**
Expand All @@ -192,17 +192,17 @@ object Effect {
with Serializable {

override def equals(other: Any): Boolean = other match {
case _: SpawnedAnonymousAdapter[_] => true
case _: SpawnedAnonymousAdapter[?] => true
case _ => false
}
override def hashCode: Int = Nil.##
override def toString: String = "SpawnedAnonymousAdapter"

override def productPrefix: String = "SpawnedAnonymousAdapter"
override def productIterator: Iterator[_] = Iterator.empty
override def productIterator: Iterator[?] = Iterator.empty
override def productArity: Int = 0
override def productElement(n: Int) = throw new NoSuchElementException
override def canEqual(o: Any): Boolean = o.isInstanceOf[SpawnedAnonymousAdapter[_]]
override def canEqual(o: Any): Boolean = o.isInstanceOf[SpawnedAnonymousAdapter[?]]
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ object TestKitSettings {
/**
* Reads configuration settings from `pekko.actor.testkit.typed` section.
*/
def apply(system: ActorSystem[_]): TestKitSettings =
def apply(system: ActorSystem[?]): TestKitSettings =
Ext(system).settings

/**
Expand All @@ -42,7 +42,7 @@ object TestKitSettings {
/**
* Java API: Reads configuration settings from `pekko.actor.testkit.typed` section.
*/
def create(system: ActorSystem[_]): TestKitSettings =
def create(system: ActorSystem[?]): TestKitSettings =
apply(system)

/**
Expand All @@ -53,11 +53,11 @@ object TestKitSettings {
new TestKitSettings(config)

private object Ext extends ExtensionId[Ext] {
override def createExtension(system: ActorSystem[_]): Ext = new Ext(system)
def get(system: ActorSystem[_]): Ext = Ext.apply(system)
override def createExtension(system: ActorSystem[?]): Ext = new Ext(system)
def get(system: ActorSystem[?]): Ext = Ext.apply(system)
}

private class Ext(system: ActorSystem[_]) extends Extension {
private class Ext(system: ActorSystem[?]) extends Extension {
val settings: TestKitSettings = TestKitSettings(system.settings.config.getConfig("pekko.actor.testkit.typed"))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ import com.typesafe.config.{ Config, ConfigFactory }
override def extension[T <: Extension](ext: ExtensionId[T]): T =
throw new UnsupportedOperationException("ActorSystemStub cannot register extensions")

override def hasExtension(ext: ExtensionId[_ <: Extension]): Boolean =
override def hasExtension(ext: ExtensionId[? <: Extension]): Boolean =
throw new UnsupportedOperationException("ActorSystemStub cannot register extensions")

override def log: Logger = LoggerFactory.getLogger(getClass)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import org.slf4j.event.Level
source: Option[String],
messageContains: Option[String],
messageRegex: Option[Regex],
cause: Option[Class[_ <: Throwable]],
cause: Option[Class[? <: Throwable]],
mdc: Map[String, String],
checkExcess: Boolean,
custom: Option[Function[LoggingEvent, Boolean]])
Expand Down Expand Up @@ -95,7 +95,7 @@ import org.slf4j.event.Level
todo > 0
}

override def expect[T](code: => T)(implicit system: ActorSystem[_]): T = {
override def expect[T](code: => T)(implicit system: ActorSystem[?]): T = {
val effectiveLoggerName = loggerName.getOrElse("")
checkLogback(system)
TestAppender.setupTestAppender(effectiveLoggerName)
Expand All @@ -120,10 +120,10 @@ import org.slf4j.event.Level
}
}

override def expect[T](system: ActorSystem[_], code: Supplier[T]): T =
override def expect[T](system: ActorSystem[?], code: Supplier[T]): T =
expect(code.get())(system)

private def checkLogback(system: ActorSystem[_]): Unit = {
private def checkLogback(system: ActorSystem[?]): Unit = {
if (!system.dynamicAccess.classIsOnClasspath("ch.qos.logback.classic.spi.ILoggingEvent")) {
throw new IllegalStateException("LoggingEventFilter requires logback-classic dependency in classpath.")
}
Expand Down Expand Up @@ -166,7 +166,7 @@ import org.slf4j.event.Level
override def withCustom(newCustom: Function[LoggingEvent, Boolean]): LoggingTestKitImpl =
copy(custom = Option(newCustom))

override def withCause(newCause: Class[_ <: Throwable]): javadsl.LoggingTestKit =
override def withCause(newCause: Class[? <: Throwable]): javadsl.LoggingTestKit =
copy(cause = Option(newCause))

}
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private[pekko] final class FunctionRef[-T](override val path: ActorPath, send: (
@InternalApi private[pekko] val selfInbox = new TestInboxImpl[T](path)

override val self = selfInbox.ref
private var _children = TreeMap.empty[String, BehaviorTestKitImpl[_]]
private var _children = TreeMap.empty[String, BehaviorTestKitImpl[?]]
private val childName = Iterator.from(0).map(Helpers.base64(_))
private val substituteLoggerFactory = new SubstituteLoggerFactory
private val logger: Logger = substituteLoggerFactory.getLogger("StubbedLogger")
Expand Down Expand Up @@ -230,7 +230,7 @@ private[pekko] final class FunctionRef[-T](override val path: ActorPath, send: (
checkCurrentActorThread()
}

override def setLoggerName(clazz: Class[_]): Unit = {
override def setLoggerName(clazz: Class[?]): Unit = {
// nop as we don't track logger
checkCurrentActorThread()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private[pekko] object TestKitUtils {
// common internal utility impls for Java and Scala
private val TestKitRegex = """org\.apache\.pekko\.testkit\.typed\.(?:javadsl|scaladsl)\.ActorTestKit(?:\$.*)?""".r

def testNameFromCallStack(classToStartFrom: Class[_]): String =
def testNameFromCallStack(classToStartFrom: Class[?]): String =
pekko.testkit.TestKitUtils.testNameFromCallStack(classToStartFrom, TestKitRegex)

/**
Expand All @@ -90,7 +90,7 @@ private[pekko] object TestKitUtils {
def scrubActorSystemName(name: String): String =
pekko.testkit.TestKitUtils.scrubActorSystemName(name)

def shutdown(system: ActorSystem[_], timeout: Duration, throwIfShutdownTimesOut: Boolean): Unit = {
def shutdown(system: ActorSystem[?], timeout: Duration, throwIfShutdownTimesOut: Boolean): Unit = {
system.terminate()
try Await.ready(system.whenTerminated, timeout)
catch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private[pekko] object TestProbeImpl {
}

@InternalApi
private[pekko] final class TestProbeImpl[M](name: String, system: ActorSystem[_])
private[pekko] final class TestProbeImpl[M](name: String, system: ActorSystem[?])
extends JavaTestProbe[M]
with ScalaTestProbe[M]
with InternalRecipientRef[M] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ object ActorTestKit {
* Config loaded from the provided actor if that exists, otherwise
* using default configuration from the reference.conf resources that ship with the Akka libraries.
*/
def create(system: ActorSystem[_]): ActorTestKit =
def create(system: ActorSystem[?]): ActorTestKit =
new ActorTestKit(scaladsl.ActorTestKit(system))

/**
Expand Down Expand Up @@ -123,7 +123,7 @@ object ActorTestKit {
* an error is printed to stdout when the system did not shutdown but
* no exception is thrown.
*/
def shutdown(system: ActorSystem[_], duration: Duration, throwIfShutdownTimesOut: Boolean): Unit = {
def shutdown(system: ActorSystem[?], duration: Duration, throwIfShutdownTimesOut: Boolean): Unit = {
TestKitUtils.shutdown(system, duration.toScala, throwIfShutdownTimesOut)
}

Expand All @@ -132,7 +132,7 @@ object ActorTestKit {
* if more time than `system-shutdown-default` passes an exception is thrown
* (can be configured with `throw-on-shutdown-timeout`).
*/
def shutdown(system: ActorSystem[_], duration: Duration): Unit = {
def shutdown(system: ActorSystem[?], duration: Duration): Unit = {
val settings = TestKitSettings.create(system)
shutdown(system, duration, settings.ThrowOnShutdownTimeout)
}
Expand All @@ -142,7 +142,7 @@ object ActorTestKit {
* if more time than `system-shutdown-default` passes an exception is thrown
* (can be configured with `throw-on-shutdown-timeout`).
*/
def shutdown(system: ActorSystem[_]): Unit = {
def shutdown(system: ActorSystem[?]): Unit = {
val settings = TestKitSettings.create(system)
shutdown(system, settings.DefaultActorSystemShutdownTimeout.toJava, settings.ThrowOnShutdownTimeout)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ import com.typesafe.config.Config
@deprecated("Use JUnitJupiterTestKitBuilder instead", "2.0.0")
final class JUnit5TestKitBuilder() {

var system: Option[ActorSystem[_]] = None
var system: Option[ActorSystem[?]] = None

var customConfig: Config = ApplicationTestConfig

var name: String = TestKitUtils.testNameFromCallStack(classOf[JUnit5TestKitBuilder])

def withSystem(system: ActorSystem[_]): JUnit5TestKitBuilder = {
def withSystem(system: ActorSystem[?]): JUnit5TestKitBuilder = {
this.system = Some(system)
this
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ import com.typesafe.config.Config

final class JUnitJupiterTestKitBuilder() {

var system: Option[ActorSystem[_]] = None
var system: Option[ActorSystem[?]] = None

var customConfig: Config = ApplicationTestConfig

var name: String = TestKitUtils.testNameFromCallStack(classOf[JUnitJupiterTestKitBuilder])

def withSystem(system: ActorSystem[_]): JUnitJupiterTestKitBuilder = {
def withSystem(system: ActorSystem[?]): JUnitJupiterTestKitBuilder = {
this.system = Some(system)
this
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ import org.slf4j.event.Level
* Matching events with an included `throwable` that is a class or subclass of the given
* `Throwable` class.
*/
def withCause(newCause: Class[_ <: Throwable]): LoggingTestKit
def withCause(newCause: Class[? <: Throwable]): LoggingTestKit

/**
* Matching events with MDC containing all entries of the given `Map`.
Expand Down Expand Up @@ -109,7 +109,7 @@ import org.slf4j.event.Level
*
* Care is taken to remove the testkit when the block is finished or aborted.
*/
def expect[T](system: ActorSystem[_], code: Supplier[T]): T
def expect[T](system: ActorSystem[?], code: Supplier[T]): T

}

Expand Down Expand Up @@ -198,7 +198,7 @@ object LoggingTestKit {
*
* More conditions can be added to the returned [LoggingEventFilter].
*/
def error(causeClass: Class[_ <: Throwable]): LoggingTestKit =
def error(causeClass: Class[? <: Throwable]): LoggingTestKit =
empty.withLogLevel(Level.ERROR).withCause(causeClass)

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ final class ManualTime(delegate: pekko.testkit.ExplicitlyTriggeredScheduler) {
def timePasses(amount: Duration): Unit = delegate.timePasses(amount.toScala)

@varargs
def expectNoMessageFor(duration: Duration, on: TestProbe[_]*): Unit = {
def expectNoMessageFor(duration: Duration, on: TestProbe[?]*): Unit = {
delegate.timePasses(duration.toScala)
on.foreach(_.expectNoMessage(Duration.ZERO))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import pekko.actor.typed.ActorSystem
/**
* Utilities to test serialization.
*/
class SerializationTestKit(system: ActorSystem[_]) {
class SerializationTestKit(system: ActorSystem[?]) {

private val delegate = new scaladsl.SerializationTestKit(system)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ final class TestKitJunitResource(_kit: ActorTestKit) extends ExternalResource {
/**
* Use a custom [[pekko.actor.typed.ActorSystem]] for the actor system.
*/
def this(system: ActorSystem[_]) = this(ActorTestKit.create(system))
def this(system: ActorSystem[?]) = this(ActorTestKit.create(system))

/**
* Use a custom config for the actor system.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@ object FishingOutcomes {

object TestProbe {

def create[M](system: ActorSystem[_]): TestProbe[M] =
def create[M](system: ActorSystem[?]): TestProbe[M] =
create(name = "testProbe", system)

def create[M](@nowarn("msg=never used") clazz: Class[M], system: ActorSystem[_]): TestProbe[M] =
def create[M](@nowarn("msg=never used") clazz: Class[M], system: ActorSystem[?]): TestProbe[M] =
create(system)

def create[M](name: String, system: ActorSystem[_]): TestProbe[M] =
def create[M](name: String, system: ActorSystem[?]): TestProbe[M] =
new TestProbeImpl[M](name, system)

def create[M](name: String, @nowarn("msg=never used") clazz: Class[M], system: ActorSystem[_]): TestProbe[M] =
def create[M](name: String, @nowarn("msg=never used") clazz: Class[M], system: ActorSystem[?]): TestProbe[M] =
new TestProbeImpl[M](name, system)
}

Expand Down
Loading