chore: Drop @unused annotation from pekko (#2241)

This commit is contained in:
He-Pin(kerr) 2025-09-20 13:28:02 +08:00 committed by GitHub
parent 5657514b39
commit 4f2434b650
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
115 changed files with 410 additions and 377 deletions

View file

@ -13,6 +13,7 @@
package org.apache.pekko.actor.testkit.typed
import scala.annotation.nowarn
import scala.concurrent.duration.FiniteDuration
import scala.jdk.DurationConverters._
@ -20,7 +21,6 @@ import org.apache.pekko
import pekko.actor.typed.{ ActorRef, Behavior, Props }
import pekko.annotation.{ DoNotInherit, InternalApi }
import pekko.util.FunctionConverters._
import pekko.util.unused
/**
* All tracked effects for the [[pekko.actor.testkit.typed.scaladsl.BehaviorTestKit]] and
@ -156,7 +156,7 @@ object Effect {
@InternalApi
private[pekko] object SpawnedAnonymousAdapter {
def apply[T]() = new SpawnedAnonymousAdapter[T](null)
def unapply[T](@unused s: SpawnedAnonymousAdapter[T]): Boolean = true
def unapply[T](@nowarn("msg=never used") s: SpawnedAnonymousAdapter[T]): Boolean = true
}
/**

View file

@ -17,6 +17,8 @@ import java.time.Duration
import java.util.{ List => JList }
import java.util.function.Supplier
import scala.annotation.nowarn
import org.apache.pekko
import pekko.actor.testkit.typed.FishingOutcome
import pekko.actor.testkit.typed.TestKitSettings
@ -27,7 +29,6 @@ import pekko.actor.typed.RecipientRef
import pekko.actor.typed.internal.InternalRecipientRef
import pekko.annotation.DoNotInherit
import pekko.japi.function.Creator
import pekko.util.unused
object FishingOutcomes {
@ -57,13 +58,13 @@ object TestProbe {
def create[M](system: ActorSystem[_]): TestProbe[M] =
create(name = "testProbe", system)
def create[M](@unused 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] =
new TestProbeImpl[M](name, system)
def create[M](name: String, @unused 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)
}

View file

@ -13,6 +13,7 @@
package org.apache.pekko.actor
import scala.annotation.nowarn
import scala.concurrent.duration.{ Duration, FiniteDuration }
import org.apache.pekko
@ -20,7 +21,6 @@ import pekko.ConfigurationException
import pekko.dispatch._
import pekko.testkit._
import pekko.util.Helpers.ConfigOps
import pekko.util.unused
import com.typesafe.config.Config
import com.typesafe.config.ConfigFactory
@ -197,7 +197,8 @@ object ActorMailboxSpec {
class StashQueueReportingActor extends QueueReportingActor with Stash
class StashQueueReportingActorWithParams(@unused i: Int, @unused s: String) extends StashQueueReportingActor
class StashQueueReportingActorWithParams(@nowarn("msg=never used") i: Int, @nowarn("msg=never used") s: String)
extends StashQueueReportingActor
val UnboundedMailboxTypes = Seq(classOf[UnboundedMessageQueueSemantics])
val BoundedMailboxTypes = Seq(classOf[BoundedMessageQueueSemantics])

View file

@ -13,6 +13,7 @@
package org.apache.pekko.actor
import scala.annotation.nowarn
import scala.concurrent.duration._
import org.apache.pekko
@ -21,7 +22,6 @@ import pekko.dispatch.BoundedDequeBasedMailbox
import pekko.testkit._
import pekko.testkit.DefaultTimeout
import pekko.testkit.TestEvent._
import pekko.util.unused
import org.scalatest.BeforeAndAfterEach
@ -67,9 +67,11 @@ object ActorWithBoundedStashSpec {
}
// bounded deque-based mailbox with capacity 10
class Bounded10(@unused settings: Settings, @unused config: Config) extends BoundedDequeBasedMailbox(10, 500.millis)
class Bounded10(@nowarn("msg=never used") settings: Settings, @nowarn("msg=never used") config: Config)
extends BoundedDequeBasedMailbox(10, 500.millis)
class Bounded100(@unused settings: Settings, @unused config: Config) extends BoundedDequeBasedMailbox(100, 500.millis)
class Bounded100(@nowarn("msg=never used") settings: Settings, @nowarn("msg=never used") config: Config)
extends BoundedDequeBasedMailbox(100, 500.millis)
val dispatcherId1 = "my-dispatcher-1"
val dispatcherId2 = "my-dispatcher-2"

View file

@ -13,13 +13,14 @@
package org.apache.pekko.actor
import scala.annotation.nowarn
import scala.concurrent.Await
import scala.concurrent.duration._
import org.apache.pekko
import pekko.event._
import pekko.testkit._
import pekko.util.{ unused, Timeout }
import pekko.util.Timeout
import com.typesafe.config.ConfigFactory
@ -88,7 +89,7 @@ object FSMActorSpec {
// verify that old-style does still compile
onTransition(transitionHandler _)
def transitionHandler(@unused from: LockState, @unused to: LockState) = {
def transitionHandler(@nowarn("msg=never used") from: LockState, @nowarn("msg=never used") to: LockState) = {
// dummy
}

View file

@ -13,9 +13,10 @@
package org.apache.pekko.actor
import scala.annotation.nowarn
import org.apache.pekko
import pekko.testkit.PekkoSpec
import pekko.util.unused
object PropsCreationSpec {
@ -23,11 +24,11 @@ object PropsCreationSpec {
final class B
class OneParamActor(@unused blackhole: A) extends Actor {
class OneParamActor(@nowarn("msg=never used") blackhole: A) extends Actor {
override def receive = Actor.emptyBehavior
}
class TwoParamActor(@unused blackhole1: A, @unused blackhole2: B) extends Actor {
class TwoParamActor(@nowarn("msg=never used") blackhole1: A, @nowarn("msg=never used") blackhole2: B) extends Actor {
override def receive = Actor.emptyBehavior
}

View file

@ -15,6 +15,7 @@ package org.apache.pekko.actor
import java.util.concurrent.atomic.AtomicInteger
import scala.annotation.nowarn
import scala.concurrent.Await
import scala.concurrent.duration._
@ -27,7 +28,6 @@ import pekko.pattern.ask
import pekko.routing.RoundRobinPool
import pekko.testkit._
import pekko.testkit.TestEvent._
import pekko.util.unused
import org.scalatest.BeforeAndAfterEach
@ -113,7 +113,8 @@ object SupervisorSpec {
val failure = new AssertionError("deliberate test failure")
class Mailbox(@unused settings: ActorSystem.Settings, @unused config: Config) extends MailboxType {
class Mailbox(@nowarn("msg=never used") settings: ActorSystem.Settings, @nowarn("msg=never used") config: Config)
extends MailboxType {
override def create(owner: Option[ActorRef], system: Option[ActorSystem]): MessageQueue =
throw failure
}

View file

@ -16,6 +16,7 @@ package org.apache.pekko.actor.dispatch
import java.util.concurrent.ConcurrentLinkedQueue
import java.util.concurrent.atomic.AtomicBoolean
import scala.annotation.nowarn
import scala.reflect.ClassTag
import org.apache.pekko
@ -24,7 +25,6 @@ import pekko.actor._
import pekko.dispatch._
import pekko.routing.FromConfig
import pekko.testkit.{ ImplicitSender, PekkoSpec }
import pekko.util.unused
import com.typesafe.config.Config
import com.typesafe.config.ConfigFactory
@ -84,7 +84,8 @@ object DispatchersSpec {
}
}
class OneShotMailboxType(@unused settings: ActorSystem.Settings, @unused config: Config)
class OneShotMailboxType(@nowarn("msg=never used") settings: ActorSystem.Settings,
@nowarn("msg=never used") config: Config)
extends MailboxType
with ProducesMessageQueue[DoublingMailbox] {
val created = new AtomicBoolean(false)

View file

@ -15,13 +15,13 @@ package org.apache.pekko.dispatch
import java.util.concurrent.{ BlockingQueue, ConcurrentLinkedQueue }
import scala.annotation.nowarn
import scala.concurrent.{ Await, ExecutionContext, Future }
import scala.concurrent.duration._
import org.apache.pekko
import pekko.actor._
import pekko.testkit.{ EventFilter, PekkoSpec }
import pekko.util.unused
import org.scalatest.{ BeforeAndAfterAll, BeforeAndAfterEach }
@ -241,14 +241,15 @@ object CustomMailboxSpec {
}
"""
class MyMailboxType(@unused settings: ActorSystem.Settings, @unused config: Config) extends MailboxType {
class MyMailboxType(@nowarn("msg=never used") settings: ActorSystem.Settings,
@nowarn("msg=never used") config: Config) extends MailboxType {
override def create(owner: Option[ActorRef], system: Option[ActorSystem]) = owner match {
case Some(o) => new MyMailbox(o)
case None => throw new Exception("no mailbox owner given")
}
}
class MyMailbox(@unused owner: ActorRef) extends UnboundedQueueBasedMessageQueue {
class MyMailbox(@nowarn("msg=never used") owner: ActorRef) extends UnboundedQueueBasedMessageQueue {
final val queue = new ConcurrentLinkedQueue[Envelope]()
}
}

View file

@ -13,12 +13,12 @@
package org.apache.pekko.dispatch
import scala.annotation.nowarn
import scala.concurrent.duration._
import org.apache.pekko
import pekko.actor.{ Actor, ActorSystem, Props }
import pekko.testkit.{ DefaultTimeout, PekkoSpec }
import pekko.util.unused
import com.typesafe.config.Config
@ -35,14 +35,14 @@ object PriorityDispatcherSpec {
}
"""
class Unbounded(@unused settings: ActorSystem.Settings, @unused config: Config)
class Unbounded(@nowarn("msg=never used") settings: ActorSystem.Settings, @nowarn("msg=never used") config: Config)
extends UnboundedPriorityMailbox(PriorityGenerator({
case i: Int => i // Reverse order
case Result => Int.MaxValue
case _ => throw new RuntimeException() // compiler exhaustiveness check pleaser
}: Any => Int))
class Bounded(@unused settings: ActorSystem.Settings, @unused config: Config)
class Bounded(@nowarn("msg=never used") settings: ActorSystem.Settings, @nowarn("msg=never used") config: Config)
extends BoundedPriorityMailbox(PriorityGenerator({
case i: Int => i // Reverse order
case Result => Int.MaxValue

View file

@ -13,12 +13,12 @@
package org.apache.pekko.dispatch
import scala.annotation.nowarn
import scala.concurrent.duration._
import org.apache.pekko
import pekko.actor.{ Actor, ActorSystem, Props }
import pekko.testkit.{ DefaultTimeout, PekkoSpec }
import pekko.util.unused
import com.typesafe.config.Config
@ -34,7 +34,7 @@ object StablePriorityDispatcherSpec {
}
"""
class Unbounded(@unused settings: ActorSystem.Settings, @unused config: Config)
class Unbounded(@nowarn("msg=never used") settings: ActorSystem.Settings, @nowarn("msg=never used") config: Config)
extends UnboundedStablePriorityMailbox(PriorityGenerator({
case i: Int if i <= 100 => i // Small integers have high priority
case _: Int => 101 // Don't care for other integers
@ -42,7 +42,7 @@ object StablePriorityDispatcherSpec {
case _ => throw new RuntimeException() // compiler exhaustiveness check pleaser
}: Any => Int))
class Bounded(@unused settings: ActorSystem.Settings, @unused config: Config)
class Bounded(@nowarn("msg=never used") settings: ActorSystem.Settings, @nowarn("msg=never used") config: Config)
extends BoundedStablePriorityMailbox(PriorityGenerator({
case i: Int if i <= 100 => i // Small integers have high priority
case _: Int => 101 // Don't care for other integers

View file

@ -29,8 +29,8 @@ import pekko.actor._
import pekko.actor.dungeon.SerializationCheckFailedException
import pekko.pattern.ask
import pekko.testkit.{ EventFilter, PekkoSpec }
import pekko.util.{ unused, Timeout }
import pekko.util.ByteString
import pekko.util.Timeout
import com.typesafe.config._
@ -86,7 +86,7 @@ object SerializationTests {
class BothTestSerializableAndJavaSerializable(s: String) extends SimpleMessage(s) with Serializable
class BothTestSerializableAndTestSerializable2(@unused s: String) extends Marker with Marker2
class BothTestSerializableAndTestSerializable2(@nowarn("msg=never used") s: String) extends Marker with Marker2
trait A
trait B
@ -121,7 +121,7 @@ object SerializationTests {
receiveBuilder().build()
}
class NonSerializableActor(@unused arg: AnyRef) extends Actor {
class NonSerializableActor(@nowarn("msg=never used") arg: AnyRef) extends Actor {
def receive = {
case s: String => sender() ! s
}

View file

@ -17,6 +17,7 @@ import java.util
import java.util.concurrent._
import java.util.concurrent.locks.{ Condition, LockSupport, ReentrantLock }
import scala.annotation.nowarn
import scala.collection.mutable
import scala.concurrent.{ Await, ExecutionContext, ExecutionContextExecutor, Future }
import scala.jdk.CollectionConverters._
@ -838,7 +839,7 @@ trait QueueSetupHelper {
}
}
def manualTimeControl(@unused on: Boolean): Unit =
def manualTimeControl(@nowarn("msg=never used") on: Boolean): Unit =
waiting = Some(Manual())
override def signalAll(): Unit = condition.signalAll()

View file

@ -13,6 +13,7 @@
package org.apache.pekko.util
import scala.annotation.nowarn
import scala.collection.immutable
import org.scalatest.matchers.should.Matchers
@ -22,8 +23,8 @@ object ReflectSpec {
final class A
final class B
class One(@unused a: A)
class Two(@unused a: A, @unused b: B)
class One(@nowarn("msg=never used") a: A)
class Two(@nowarn("msg=never used") a: A, @nowarn("msg=never used") b: B)
class MultipleOne(a: A, b: B) {
def this(a: A) = this(a, null)

View file

@ -16,6 +16,7 @@ package org.apache.pekko.actor.typed.internal
import java.util.function.{ Function => JFunction }
import java.util.function.Predicate
import scala.annotation.nowarn
import scala.annotation.tailrec
import scala.util.control.NonFatal
@ -29,7 +30,7 @@ import pekko.actor.typed.scaladsl
import pekko.actor.typed.scaladsl.ActorContext
import pekko.annotation.{ InternalApi, InternalStableApi }
import pekko.japi.function.Procedure
import pekko.util.{ unused, ConstantFun }
import pekko.util.ConstantFun
import pekko.util.OptionVal
/**
@ -97,7 +98,7 @@ import pekko.util.OptionVal
}
@InternalStableApi
private def createNode(message: T, @unused ctx: scaladsl.ActorContext[T]): Node[T] = {
private def createNode(message: T, @nowarn("msg=never used") ctx: scaladsl.ActorContext[T]): Node[T] = {
new Node(null, message)
}
@ -117,7 +118,7 @@ import pekko.util.OptionVal
behavior: Behavior[T],
ctx: TypedActorContext[T],
wrappedMessage: T,
@unused node: Node[T]): Behavior[T] = {
@nowarn("msg=never used") node: Node[T]): Behavior[T] = {
Behavior.interpretMessage(behavior, ctx, wrappedMessage)
}
@ -259,10 +260,11 @@ import pekko.util.OptionVal
s"StashBuffer($size/$capacity)"
@InternalStableApi
private[pekko] def unstashed(@unused ctx: ActorContext[T], @unused node: Node[T]): Unit = ()
private[pekko] def unstashed(@nowarn("msg=never used") ctx: ActorContext[T], @nowarn("msg=never used") node: Node[T])
: Unit = ()
@InternalStableApi
private def stashCleared(@unused ctx: ActorContext[T]): Unit = ()
private def stashCleared(@nowarn("msg=never used") ctx: ActorContext[T]): Unit = ()
}

View file

@ -16,6 +16,7 @@ package internal
import java.util.concurrent.ThreadLocalRandom
import scala.annotation.nowarn
import scala.concurrent.duration.Deadline
import scala.concurrent.duration.FiniteDuration
import scala.reflect.ClassTag
@ -35,7 +36,6 @@ import pekko.actor.typed.scaladsl.StashBuffer
import pekko.annotation.InternalApi
import pekko.event.Logging
import pekko.util.OptionVal
import pekko.util.unused
import org.slf4j.event.Level
@ -143,7 +143,7 @@ private abstract class SimpleSupervisor[T, Thr <: Throwable: ClassTag](ss: Super
} catch handleReceiveException(ctx, target)
}
protected def handleException(@unused ctx: TypedActorContext[Any]): Catcher[Behavior[T]] = {
protected def handleException(@nowarn("msg=never used") ctx: TypedActorContext[Any]): Catcher[Behavior[T]] = {
case NonFatal(t) if isInstanceOfTheThrowableClass(t) =>
BehaviorImpl.failed(t)
}
@ -157,7 +157,8 @@ private abstract class SimpleSupervisor[T, Thr <: Throwable: ClassTag](ss: Super
handleException(ctx)
}
private class StopSupervisor[T, Thr <: Throwable: ClassTag](@unused initial: Behavior[T], strategy: Stop)
private class StopSupervisor[T, Thr <: Throwable: ClassTag](@nowarn("msg=never used") initial: Behavior[T],
strategy: Stop)
extends SimpleSupervisor[T, Thr](strategy) {
override def handleException(ctx: TypedActorContext[Any]): Catcher[Behavior[T]] = {
@ -294,7 +295,7 @@ private class RestartSupervisor[T, Thr <: Throwable: ClassTag](initial: Behavior
override protected def handleExceptionOnStart(
ctx: TypedActorContext[Any],
@unused target: PreStartTarget[T]): Catcher[Behavior[T]] = {
@nowarn("msg=never used") target: PreStartTarget[T]): Catcher[Behavior[T]] = {
case NonFatal(t) if isInstanceOfTheThrowableClass(t) =>
ctx.asScala.cancelAllTimers()
strategy match {

View file

@ -16,6 +16,7 @@ package org.apache.pekko.actor.typed.javadsl
import java.util.Collections
import java.util.function.{ Function => JFunction, Supplier }
import scala.annotation.nowarn
import scala.jdk.CollectionConverters._
import scala.reflect.ClassTag
@ -24,7 +25,6 @@ import pekko.actor.typed._
import pekko.actor.typed.internal.{ BehaviorImpl, StashBufferImpl, TimerSchedulerImpl, WithMdcBehaviorInterceptor }
import pekko.japi.function.{ Effect, Function2 => JapiFunction2 }
import pekko.japi.pf.PFBuilder
import pekko.util.unused
/**
* Factories for [[pekko.actor.typed.Behavior]].
@ -199,7 +199,7 @@ object Behaviors {
* @param type the supertype of all messages accepted by this behavior
* @return the behavior builder
*/
def receive[T](@unused `type`: Class[T]): BehaviorBuilder[T] = BehaviorBuilder.create[T]
def receive[T](@nowarn("msg=never used") `type`: Class[T]): BehaviorBuilder[T] = BehaviorBuilder.create[T]
/**
* Construct an actor behavior that can react to lifecycle signals only.

View file

@ -28,7 +28,7 @@ import pekko.actor.typed.internal.InternalRecipientRef
import pekko.annotation.InternalStableApi
import pekko.pattern.PromiseActorRef
import pekko.pattern.StatusReply
import pekko.util.{ unused, Timeout }
import pekko.util.Timeout
/**
* The ask-pattern implements the initiator side of a requestreply protocol.
@ -168,7 +168,8 @@ object AskPattern {
val promiseRef: PromiseActorRef = _promiseRef
@InternalStableApi
private[pekko] def ask[T](target: InternalRecipientRef[T], message: T, @unused timeout: Timeout): Future[U] = {
private[pekko] def ask[T](target: InternalRecipientRef[T], message: T, @nowarn("msg=never used") timeout: Timeout)
: Future[U] = {
target ! message
future
}

View file

@ -24,3 +24,4 @@ ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.compat.Future$")
ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.util.ccompat.package")
ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.util.ccompat.package$")
ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.util.ccompat.package$JavaConverters$")
ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.util.unused")

View file

@ -989,7 +989,7 @@ sealed abstract class ByteString
* @param buffer a ByteBuffer to copy bytes to
* @return the number of bytes actually copied
*/
def copyToBuffer(@unused buffer: ByteBuffer): Int
def copyToBuffer(@nowarn("msg=never used") buffer: ByteBuffer): Int
/**
* Create a new ByteString with all contents compacted into a single,

View file

@ -19,7 +19,7 @@ import java.nio.{ ByteBuffer, ByteOrder }
import java.nio.charset.{ Charset, StandardCharsets }
import java.util.Base64
import scala.annotation.{ tailrec, varargs }
import scala.annotation.{ nowarn, tailrec, varargs }
import scala.collection.{ immutable, mutable }
import scala.collection.immutable.{ IndexedSeq, IndexedSeqOps, StrictOptimizedSeqOps, VectorBuilder }
import scala.collection.mutable.{ Builder, WrappedArray }
@ -992,7 +992,7 @@ sealed abstract class ByteString
* @param buffer a ByteBuffer to copy bytes to
* @return the number of bytes actually copied
*/
def copyToBuffer(@unused buffer: ByteBuffer): Int
def copyToBuffer(@nowarn("msg=never used") buffer: ByteBuffer): Int
/**
* Create a new ByteString with all contents compacted into a single,

View file

@ -17,7 +17,7 @@ import scala.concurrent.duration.FiniteDuration
import scala.jdk.DurationConverters._
import org.apache.pekko
import org.apache.pekko.japi.function.{ Effect, Function2, Predicate, Predicate2, Procedure, Procedure2, Procedure3 }
import pekko.japi.function.{ Effect, Function2, Predicate, Predicate2, Procedure, Procedure2, Procedure3 }
/**
* Java API: compatible with lambda expressions

View file

@ -15,6 +15,7 @@ package org.apache.pekko.actor
import java.util.Optional
import scala.annotation.nowarn
import scala.annotation.tailrec
import scala.beans.BeanProperty
import scala.util.control.NoStackTrace
@ -23,7 +24,6 @@ import org.apache.pekko
import pekko.PekkoException
import pekko.annotation.InternalApi
import pekko.event.LoggingAdapter
import pekko.util.unused
/**
* INTERNAL API
@ -370,7 +370,7 @@ trait ActorLogging { this: Actor =>
trait DiagnosticActorLogging extends Actor {
import pekko.event.Logging._
val log = pekko.event.Logging(this)
def mdc(@unused currentMessage: Any): MDC = emptyMDC
def mdc(@nowarn("msg=never used") currentMessage: Any): MDC = emptyMDC
override protected[pekko] def aroundReceive(receive: Actor.Receive, msg: Any): Unit =
try {
@ -622,7 +622,7 @@ trait Actor {
*/
@throws(classOf[Exception]) // when changing this you MUST also change ActorDocTest
// #lifecycle-hooks
def preRestart(@unused reason: Throwable, @unused message: Option[Any]): Unit = {
def preRestart(@nowarn("msg=never used") reason: Throwable, @nowarn("msg=never used") message: Option[Any]): Unit = {
context.children.foreach { child =>
context.unwatch(child)
context.stop(child)
@ -640,7 +640,7 @@ trait Actor {
*/
@throws(classOf[Exception]) // when changing this you MUST also change ActorDocTest
// #lifecycle-hooks
def postRestart(@unused reason: Throwable): Unit = {
def postRestart(@nowarn("msg=never used") reason: Throwable): Unit = {
preStart()
}
// #lifecycle-hooks

View file

@ -30,7 +30,6 @@ import pekko.dispatch.{ Envelope, MessageDispatcher }
import pekko.dispatch.sysmsg._
import pekko.event.Logging.{ Debug, Error, LogEvent }
import pekko.japi.function.Procedure
import pekko.util.unused
/**
* The actor context - the view of the actor cell from the actor.
@ -240,7 +239,7 @@ trait ActorContext extends ActorRefFactory with ClassicActorContextProvider {
/**
* ActorContexts shouldn't be Serializable
*/
final protected def writeObject(@unused o: ObjectOutputStream): Unit =
final protected def writeObject(@nowarn("msg=never used") o: ObjectOutputStream): Unit =
throw new NotSerializableException("ActorContext is not serializable!")
}

View file

@ -13,6 +13,7 @@
package org.apache.pekko.actor
import scala.annotation.nowarn
import scala.collection.mutable
import scala.concurrent.ExecutionContextExecutor
import scala.concurrent.duration._
@ -24,7 +25,6 @@ import language.implicitConversions
import org.apache.pekko
import pekko.annotation.InternalApi
import pekko.routing.{ Deafen, Listen, Listeners }
import pekko.util.unused
object FSM {
@ -834,7 +834,7 @@ trait FSM[S, D] extends Actor with Listeners with ActorLogging {
processEvent(event, source)
}
private[pekko] def processEvent(event: Event, @unused source: AnyRef): Unit = {
private[pekko] def processEvent(event: Event, @nowarn("msg=never used") source: AnyRef): Unit = {
val stateFunc = stateFunctions(currentState.stateName)
val nextState = if (stateFunc.isDefinedAt(event)) {
stateFunc(event)

View file

@ -26,7 +26,6 @@ import pekko.actor.dungeon.ChildrenContainer
import pekko.dispatch._
import pekko.dispatch.sysmsg._
import pekko.event.Logging.Warning
import pekko.util.unused
/**
* This actor ref starts out with some dummy cell (by default just enqueuing
@ -136,7 +135,7 @@ private[pekko] class RepointableActorRef(
* This is called by activate() to obtain the cell which is to replace the
* unstarted cell. The cell must be fully functional.
*/
def newCell(@unused old: UnstartedCell): Cell =
def newCell(@nowarn("msg=never used") old: UnstartedCell): Cell =
new ActorCell(system, this, props, dispatcher, supervisor).init(sendSupervise = false, mailboxType)
def start(): Unit = ()

View file

@ -13,12 +13,13 @@
package org.apache.pekko.actor.dungeon
import scala.annotation.nowarn
import org.apache.pekko
import pekko.actor.{ Actor, ActorCell, ActorRef, ActorRefScope, Address, InternalActorRef, Terminated }
import pekko.dispatch.sysmsg.{ DeathWatchNotification, Unwatch, Watch }
import pekko.event.AddressTerminatedTopic
import pekko.event.Logging.{ Debug, Warning }
import pekko.util.unused
private[pekko] trait DeathWatch { this: ActorCell =>
@ -162,7 +163,7 @@ private[pekko] trait DeathWatch { this: ActorCell =>
}
}
protected def unwatchWatchedActors(@unused actor: Actor): Unit =
protected def unwatchWatchedActors(@nowarn("msg=never used") actor: Actor): Unit =
if (watching.nonEmpty) {
maintainAddressTerminatedSubscription() {
try {

View file

@ -28,7 +28,7 @@ import pekko.dispatch.affinity.AffinityPoolConfigurator
import pekko.dispatch.sysmsg._
import pekko.event.EventStream
import pekko.event.Logging.{ emptyMDC, Debug, Error, LogEventException, Warning }
import pekko.util.{ unused, Index, JavaVersion }
import pekko.util.{ Index, JavaVersion }
import com.typesafe.config.Config
@ -350,7 +350,8 @@ abstract class MessageDispatcher(val configurator: MessageDispatcherConfigurator
/**
* An ExecutorServiceConfigurator is a class that given some prerequisites and a configuration can create instances of ExecutorService
*/
abstract class ExecutorServiceConfigurator(@unused config: Config, @unused prerequisites: DispatcherPrerequisites)
abstract class ExecutorServiceConfigurator(@nowarn("msg=never used") config: Config,
@nowarn("msg=never used") prerequisites: DispatcherPrerequisites)
extends ExecutorServiceFactoryProvider
/**
@ -517,7 +518,7 @@ class ThreadPoolExecutorConfigurator(config: Config, prerequisites: DispatcherPr
protected def createThreadPoolConfigBuilder(
config: Config,
@unused prerequisites: DispatcherPrerequisites): ThreadPoolConfigBuilder = {
@nowarn("msg=never used") prerequisites: DispatcherPrerequisites): ThreadPoolConfigBuilder = {
import org.apache.pekko.util.Helpers.ConfigOps
val builder =
ThreadPoolConfigBuilder(ThreadPoolConfig())

View file

@ -15,10 +15,11 @@ package org.apache.pekko.event
import java.util.concurrent.atomic.AtomicInteger
import scala.annotation.nowarn
import org.apache.pekko
import pekko.actor._
import pekko.event.Logging.simpleName
import pekko.util.unused
/**
* INTERNAL API
@ -89,7 +90,7 @@ private[pekko] object ActorClassificationUnsubscriber {
system: ActorSystem,
busName: String,
unsubscribe: ActorRef => Unit,
@unused debug: Boolean = false): ActorRef = {
@nowarn("msg=never used") debug: Boolean = false): ActorRef = {
val debug = system.settings.config.getBoolean("pekko.actor.debug.event-stream")
system
.asInstanceOf[ExtendedActorSystem]

View file

@ -13,6 +13,8 @@
package org.apache.pekko.event
import scala.annotation.nowarn
import org.apache.pekko
import pekko.actor.ActorRef
import pekko.actor.ActorSystem
@ -21,7 +23,6 @@ import pekko.dispatch.MessageQueue
import pekko.dispatch.ProducesMessageQueue
import pekko.dispatch.UnboundedMailbox
import pekko.event.Logging.LogEvent
import pekko.util.unused
import com.typesafe.config.Config
@ -30,7 +31,8 @@ trait LoggerMessageQueueSemantics
/**
* INTERNAL API
*/
private[pekko] class LoggerMailboxType(@unused settings: ActorSystem.Settings, @unused config: Config)
private[pekko] class LoggerMailboxType(@nowarn("msg=never used") settings: ActorSystem.Settings,
@nowarn("msg=never used") config: Config)
extends MailboxType
with ProducesMessageQueue[LoggerMailbox] {
@ -43,7 +45,7 @@ private[pekko] class LoggerMailboxType(@unused settings: ActorSystem.Settings, @
/**
* INTERNAL API
*/
private[pekko] class LoggerMailbox(@unused owner: ActorRef, system: ActorSystem)
private[pekko] class LoggerMailbox(@nowarn("msg=never used") owner: ActorRef, system: ActorSystem)
extends UnboundedMailbox.MessageQueue
with LoggerMessageQueueSemantics {

View file

@ -33,7 +33,6 @@ import pekko.dispatch.RequiresMessageQueue
import pekko.event.Logging._
import pekko.util.Helpers
import pekko.util.Timeout
import pekko.util.unused
/**
* This trait brings log level handling to the EventStream: it reads the log
@ -291,7 +290,7 @@ trait LoggingBus extends ActorEventBus {
"Cannot find LogSource for ${T} please see ScalaDoc for LogSource for how to obtain or construct one.") trait LogSource[
-T] {
def genString(t: T): String
def genString(t: T, @unused system: ActorSystem): String = genString(t)
def genString(t: T, @nowarn("msg=never used") system: ActorSystem): String = genString(t)
def getClazz(t: T): Class[_] = t.getClass
}
@ -487,7 +486,7 @@ object Logging {
/**
* INTERNAL API
*/
private[pekko] class LogExt(@unused system: ExtendedActorSystem) extends Extension {
private[pekko] class LogExt(@nowarn("msg=never used") system: ExtendedActorSystem) extends Extension {
private val loggerId = new AtomicInteger
def id() = loggerId.incrementAndGet()
}
@ -1222,7 +1221,8 @@ trait LoggingAdapter {
protected def notifyError(message: String): Unit
protected def notifyError(cause: Throwable, message: String): Unit
protected def notifyWarning(message: String): Unit
protected def notifyWarning(@unused cause: Throwable, message: String): Unit = notifyWarning(message)
protected def notifyWarning(@nowarn("msg=never used") cause: Throwable, message: String): Unit =
notifyWarning(message)
protected def notifyInfo(message: String): Unit
protected def notifyDebug(message: String): Unit

View file

@ -25,7 +25,6 @@ import pekko.annotation.DoNotInherit
import pekko.annotation.InternalApi
import pekko.event.Logging
import pekko.io.dns.DnsProtocol
import pekko.util.unused
import com.typesafe.config.Config
@ -37,7 +36,7 @@ import com.typesafe.config.Config
@DoNotInherit
abstract class Dns {
def cached(@unused request: DnsProtocol.Resolve): Option[DnsProtocol.Resolved] = None
def cached(@nowarn("msg=never used") request: DnsProtocol.Resolve): Option[DnsProtocol.Resolved] = None
def resolve(request: DnsProtocol.Resolve, system: ActorSystem, sender: ActorRef): Option[DnsProtocol.Resolved] = {
val ret = cached(request)

View file

@ -18,8 +18,7 @@ import java.net.ServerSocket
import java.net.Socket
import java.nio.channels.DatagramChannel
import org.apache.pekko
import pekko.util.unused
import scala.annotation.nowarn
object Inet {
@ -32,22 +31,22 @@ object Inet {
/**
* Action to be taken for this option before bind() is called
*/
def beforeDatagramBind(@unused ds: DatagramSocket): Unit = ()
def beforeDatagramBind(@nowarn("msg=never used") ds: DatagramSocket): Unit = ()
/**
* Action to be taken for this option before bind() is called
*/
def beforeServerSocketBind(@unused ss: ServerSocket): Unit = ()
def beforeServerSocketBind(@nowarn("msg=never used") ss: ServerSocket): Unit = ()
/**
* Action to be taken for this option before calling connect()
*/
def beforeConnect(@unused s: Socket): Unit = ()
def beforeConnect(@nowarn("msg=never used") s: Socket): Unit = ()
/**
* Action to be taken for this option after connect returned.
*/
def afterConnect(@unused s: Socket): Unit = ()
def afterConnect(@nowarn("msg=never used") s: Socket): Unit = ()
}
/**
@ -61,17 +60,17 @@ object Inet {
/**
* Action to be taken for this option after connect returned.
*/
def afterBind(@unused s: DatagramSocket): Unit = ()
def afterBind(@nowarn("msg=never used") s: DatagramSocket): Unit = ()
/**
* Action to be taken for this option after connect returned.
*/
def afterBind(@unused s: ServerSocket): Unit = ()
def afterBind(@nowarn("msg=never used") s: ServerSocket): Unit = ()
/**
* Action to be taken for this option after connect returned.
*/
def afterConnect(@unused s: DatagramSocket): Unit = ()
def afterConnect(@nowarn("msg=never used") s: DatagramSocket): Unit = ()
}

View file

@ -18,7 +18,7 @@ import java.nio.ByteBuffer
import java.nio.channels.DatagramChannel
import java.nio.channels.SelectionKey._
import scala.annotation.tailrec
import scala.annotation.{ nowarn, tailrec }
import scala.util.control.NonFatal
import org.apache.pekko
@ -28,7 +28,7 @@ import pekko.dispatch.{ RequiresMessageQueue, UnboundedMessageQueueSemantics }
import pekko.io.SelectionHandler._
import pekko.io.UdpConnected._
import pekko.io.dns.DnsProtocol
import pekko.util.{ unused, ByteString }
import pekko.util.ByteString
/**
* INTERNAL API
@ -79,7 +79,7 @@ private[io] class UdpConnection(
}
}
def doConnect(@unused address: InetSocketAddress): Unit = {
def doConnect(@nowarn("msg=never used") address: InetSocketAddress): Unit = {
channel = DatagramChannel.open
channel.configureBlocking(false)
val socket = channel.socket

View file

@ -15,6 +15,7 @@ package org.apache.pekko.io.dns
import java.net.{ Inet4Address, Inet6Address, InetAddress }
import scala.annotation.nowarn
import scala.annotation.switch
import scala.concurrent.duration._
@ -25,7 +26,7 @@ import pekko.actor.NoSerializationVerificationNeeded
import pekko.annotation.DoNotInherit
import pekko.annotation.InternalApi
import pekko.io.dns.internal.{ DomainName, _ }
import pekko.util.{ unused, ByteIterator, ByteString }
import pekko.util.{ ByteIterator, ByteString }
/**
* Not for user extension
@ -46,7 +47,7 @@ final case class ARecord(override val name: String, override val ttl: CachePolic
*/
@InternalApi
private[io] object ARecord {
def parseBody(name: String, ttl: Ttl, @unused length: Short, it: ByteIterator): ARecord = {
def parseBody(name: String, ttl: Ttl, @nowarn("msg=never used") length: Short, it: ByteIterator): ARecord = {
val address = Array.ofDim[Byte](4)
it.getBytes(address)
ARecord(name, ttl, InetAddress.getByAddress(address).asInstanceOf[Inet4Address])
@ -66,7 +67,7 @@ private[io] object AAAARecord {
* INTERNAL API
*/
@InternalApi
def parseBody(name: String, ttl: Ttl, @unused length: Short, it: ByteIterator): AAAARecord = {
def parseBody(name: String, ttl: Ttl, @nowarn("msg=never used") length: Short, it: ByteIterator): AAAARecord = {
val address = Array.ofDim[Byte](16)
it.getBytes(address)
AAAARecord(name, ttl, InetAddress.getByAddress(address).asInstanceOf[Inet6Address])
@ -83,7 +84,8 @@ private[dns] object CNameRecord {
* INTERNAL API
*/
@InternalApi
def parseBody(name: String, ttl: Ttl, @unused length: Short, it: ByteIterator, msg: ByteString): CNameRecord = {
def parseBody(name: String, ttl: Ttl, @nowarn("msg=never used") length: Short, it: ByteIterator, msg: ByteString)
: CNameRecord = {
CNameRecord(name, ttl, DomainName.parse(it, msg))
}
}
@ -107,7 +109,8 @@ private[dns] object SRVRecord {
* INTERNAL API
*/
@InternalApi
def parseBody(name: String, ttl: Ttl, @unused length: Short, it: ByteIterator, msg: ByteString): SRVRecord = {
def parseBody(name: String, ttl: Ttl, @nowarn("msg=never used") length: Short, it: ByteIterator, msg: ByteString)
: SRVRecord = {
val priority = it.getShort.toInt & 0xFFFF
val weight = it.getShort.toInt & 0xFFFF
val port = it.getShort.toInt & 0xFFFF
@ -138,7 +141,7 @@ private[dns] object UnknownRecord {
ttl: Ttl,
recType: Short,
recClass: Short,
@unused length: Short,
@nowarn("msg=never used") length: Short,
it: ByteIterator): UnknownRecord =
UnknownRecord(name, ttl, recType, recClass, it.toByteString)
}

View file

@ -28,7 +28,7 @@ import org.apache.pekko
import pekko.actor._
import pekko.annotation.{ InternalApi, InternalStableApi }
import pekko.dispatch.sysmsg._
import pekko.util.{ unused, ByteString, Timeout }
import pekko.util.{ ByteString, Timeout }
/**
* This is what is used to complete a Future that is returned from an ask/? call,
@ -674,22 +674,24 @@ private[pekko] final class PromiseActorRef(
}
@InternalStableApi
private[pekko] def ask(actorSel: ActorSelection, message: Any, @unused timeout: Timeout): Future[Any] = {
private[pekko] def ask(actorSel: ActorSelection, message: Any, @nowarn("msg=never used") timeout: Timeout)
: Future[Any] = {
actorSel.tell(message, this)
result.future
}
@InternalStableApi
private[pekko] def ask(actorRef: ActorRef, message: Any, @unused timeout: Timeout): Future[Any] = {
private[pekko] def ask(actorRef: ActorRef, message: Any, @nowarn("msg=never used") timeout: Timeout): Future[Any] = {
actorRef.tell(message, this)
result.future
}
@InternalStableApi
private[pekko] def onComplete(@unused message: Any, @unused alreadyCompleted: Boolean): Unit = {}
private[pekko] def onComplete(@nowarn("msg=never used") message: Any,
@nowarn("msg=never used") alreadyCompleted: Boolean): Unit = {}
@InternalStableApi
private[pekko] def onTimeout(@unused timeout: Timeout): Unit = {}
private[pekko] def onTimeout(@nowarn("msg=never used") timeout: Timeout): Unit = {}
}
/**

View file

@ -15,6 +15,7 @@ package org.apache.pekko.pattern
import java.util.concurrent.CompletionStage
import scala.annotation.nowarn
import scala.concurrent.{ ExecutionContext, Future }
import scala.util.{ Failure, Success }
@ -23,7 +24,6 @@ import language.implicitConversions
import org.apache.pekko
import pekko.actor.{ Actor, ActorRef, Status }
import pekko.actor.ActorSelection
import pekko.util.unused
trait PipeToSupport {
@ -53,7 +53,7 @@ trait PipeToSupport {
}
final class PipeableCompletionStage[T](val future: CompletionStage[T])(
implicit @unused executionContext: ExecutionContext) {
implicit @nowarn("msg=never used") executionContext: ExecutionContext) {
def pipeTo(recipient: ActorRef)(implicit sender: ActorRef = Actor.noSender): CompletionStage[T] = {
future.whenComplete((t: T, ex: Throwable) => {
if (t != null) recipient ! t

View file

@ -28,7 +28,6 @@ import pekko.actor.SupervisorStrategy
import pekko.actor.Terminated
import pekko.dispatch.Dispatchers
import pekko.japi.Util.immutableSeq
import pekko.util.unused
/**
* This trait represents a router factory: it produces the actual router actor
@ -72,7 +71,7 @@ trait RouterConfig extends Serializable {
* Management messages not handled by the "head" actor are
* delegated to this controller actor.
*/
def routingLogicController(@unused routingLogic: RoutingLogic): Option[Props] = None
def routingLogicController(@nowarn("msg=never used") routingLogic: RoutingLogic): Option[Props] = None
/**
* Is the message handled by the router head actor or the
@ -92,12 +91,12 @@ trait RouterConfig extends Serializable {
/**
* Overridable merge strategy, by default completely prefers `this` (i.e. no merge).
*/
def withFallback(@unused other: RouterConfig): RouterConfig = this
def withFallback(@nowarn("msg=never used") other: RouterConfig): RouterConfig = this
/**
* Check that everything is there which is needed. Called in constructor of RoutedActorRef to fail early.
*/
def verifyConfig(@unused path: ActorPath): Unit = ()
def verifyConfig(@nowarn("msg=never used") path: ActorPath): Unit = ()
/**
* INTERNAL API

View file

@ -1,37 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* license agreements; and to You under the Apache License, version 2.0:
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* This file is part of the Apache Pekko project, which was derived from Akka.
*/
/*
* Copyright (C) 2018-2022 Lightbend Inc. <https://www.lightbend.com>
*/
package org.apache.pekko.util
import scala.annotation.nowarn
import org.apache.pekko.annotation.InternalApi
/**
* Marker for explicit or implicit parameter known to be unused, yet
* still necessary from a binary compatibility perspective
* or other reason. Useful in combination with
* `-Ywarn-unused:explicits,implicits` compiler options.
*
* Extends 'deprecated' to make sure using a parameter marked @unused
* produces a warning, and not using a parameter marked @unused does not
* produce an 'unused parameter' warning.
*
* This approach is deprecated in Scala 2.13 and scheduled to be
* removed in 2.14. Perhaps we should promote introducing an `@unused`
* to Scala? https://contributors.scala-lang.org/t/more-error-reporting-annotations/1681/7
*
* INTERNAL API
*/
@nowarn("msg=deprecated")
@InternalApi private[pekko] class unused extends deprecated("unused", "")

View file

@ -34,7 +34,6 @@ import pekko.routing.Routees
import pekko.serialization.jackson.CborSerializable
import pekko.testkit.{ DefaultTimeout, ImplicitSender, LongRunningTest }
import pekko.testkit.GHExcludeTest
import pekko.util.unused
import com.typesafe.config.Config
import com.typesafe.config.ConfigFactory
@ -121,7 +120,7 @@ object AdaptiveLoadBalancingRouterConfig extends MultiNodeConfig {
}
class TestCustomMetricsSelector(@unused config: Config) extends MetricsSelector {
class TestCustomMetricsSelector(@nowarn("msg=never used") config: Config) extends MetricsSelector {
override def weights(nodeMetrics: Set[NodeMetrics]): Map[Address, Int] = Map.empty
}

View file

@ -13,9 +13,10 @@
package org.apache.pekko.cluster.sharding.typed
import scala.annotation.nowarn
import org.apache.pekko
import pekko.actor.{ InvalidMessageException, WrappedMessage }
import pekko.util.unused
object ShardingMessageExtractor {
@ -33,7 +34,7 @@ object ShardingMessageExtractor {
/**
* Scala API: Create a message extractor for a protocol where the entity id is available in each message.
*/
def noEnvelope[M](numberOfShards: Int, @unused stopMessage: M)(
def noEnvelope[M](numberOfShards: Int, @nowarn("msg=never used") stopMessage: M)(
extractEntityId: M => String): ShardingMessageExtractor[M, M] =
new HashCodeNoEnvelopeMessageExtractor[M](numberOfShards) {
def entityId(message: M) = extractEntityId(message)

View file

@ -19,6 +19,7 @@ import java.time.Duration
import java.util.concurrent.CompletionStage
import java.util.concurrent.ConcurrentHashMap
import scala.annotation.nowarn
import scala.concurrent.Future
import scala.jdk.DurationConverters._
import scala.jdk.FutureConverters._
@ -51,7 +52,7 @@ import pekko.japi.function.{ Function => JFunction }
import pekko.pattern.AskTimeoutException
import pekko.pattern.PromiseActorRef
import pekko.pattern.StatusReply
import pekko.util.{ unused, ByteString, Timeout }
import pekko.util.{ ByteString, Timeout }
/**
* INTERNAL API
@ -396,7 +397,7 @@ import pekko.util.{ unused, ByteString, Timeout }
shardRegion: pekko.actor.ActorRef,
entityId: String,
message: T,
@unused timeout: Timeout): Future[U] = {
@nowarn("msg=never used") timeout: Timeout): Future[U] = {
shardRegion ! ShardingEnvelope(entityId, message)
future
}

View file

@ -396,7 +396,7 @@ final class EntityContext[M](
}
@nowarn // for unused msgClass to make class type explicit in the Java API. Not using @unused as the user is likely to see it
@nowarn // for unused msgClass to make class type explicit in the Java API. Not using @nowarn("msg=never used") as the user is likely to see it
/** Allows starting a specific Sharded Entity by its entity identifier */
object StartEntity {

View file

@ -16,6 +16,7 @@ package org.apache.pekko.cluster.sharding
import java.net.URLEncoder
import java.util
import scala.annotation.nowarn
import scala.collection.immutable.Set
import scala.concurrent.duration._
@ -50,7 +51,6 @@ import pekko.pattern.pipe
import pekko.util.MessageBufferMap
import pekko.util.OptionVal
import pekko.util.PrettyDuration._
import pekko.util.unused
/**
* INTERNAL API
@ -424,7 +424,7 @@ private[pekko] class Shard(
entityProps: String => Props,
settings: ClusterShardingSettings,
extractEntityId: ShardRegion.ExtractEntityId,
@unused extractShardId: ShardRegion.ExtractShardId,
@nowarn("msg=never used") extractShardId: ShardRegion.ExtractShardId,
handOffStopMessage: Any,
rememberEntitiesProvider: Option[RememberEntitiesProvider])
extends Actor
@ -1141,7 +1141,7 @@ private[pekko] class Shard(
* of active entities.
*/
@InternalStableApi
def entityCreated(@unused id: EntityId): Int = entities.nrActiveEntities()
def entityCreated(@nowarn("msg=never used") id: EntityId): Int = entities.nrActiveEntities()
// ===== buffering while busy saving a start or stop when remembering entities =====
def appendToMessageBuffer(id: EntityId, msg: Any, snd: ActorRef): Unit = {

View file

@ -35,7 +35,6 @@ import pekko.remote.testkit.STMultiNodeSpec
import pekko.remote.transport.ThrottlerTransportAdapter.Direction
import pekko.testkit._
import pekko.util.Timeout
import pekko.util.unused
import com.typesafe.config.ConfigFactory
@ -200,7 +199,7 @@ class ClusterClientSpec extends MultiNodeSpec(ClusterClientSpec) with STMultiNod
node(r) / "system" / "receptionist"
}
@unused
@nowarn("msg=never used")
def docOnly = { // not used, only demo
// #initialContacts
val initialContacts = Set(

View file

@ -13,13 +13,13 @@
package org.apache.pekko.cluster
import scala.annotation.nowarn
import scala.collection.immutable
import scala.concurrent.duration.{ Deadline, _ }
import org.apache.pekko
import pekko.actor.{ Actor, ActorRef, Address, CoordinatedShutdown, ReceiveTimeout }
import pekko.annotation.{ InternalApi, InternalStableApi }
import pekko.util.unused
/**
* INTERNAL API.
@ -327,7 +327,8 @@ private[cluster] final class JoinSeedNodeProcess(
}
@InternalStableApi
private[pekko] def onReceiveTimeout(@unused seedNodes: immutable.IndexedSeq[Address], @unused attempt: Int): Unit = {}
private[pekko] def onReceiveTimeout(@nowarn("msg=never used") seedNodes: immutable.IndexedSeq[Address],
@nowarn("msg=never used") attempt: Int): Unit = {}
def done: Actor.Receive = {
case InitJoinAck(_, _) => // already received one, skip rest

View file

@ -16,6 +16,7 @@ package org.apache.pekko.cluster
import java.io.NotSerializableException
import java.nio.charset.StandardCharsets
import scala.annotation.nowarn
import scala.concurrent.duration._
import org.apache.pekko
@ -30,7 +31,6 @@ import pekko.remote.testconductor.RoleName
import pekko.remote.testkit.MultiNodeConfig
import pekko.serialization.SerializerWithStringManifest
import pekko.testkit._
import pekko.util.unused
import com.typesafe.config.ConfigFactory
@ -76,7 +76,7 @@ object LargeMessageClusterMultiJvmSpec extends MultiNodeConfig {
final case class Slow(payload: Array[Byte])
class SlowSerializer(@unused system: ExtendedActorSystem) extends SerializerWithStringManifest {
class SlowSerializer(@nowarn("msg=never used") system: ExtendedActorSystem) extends SerializerWithStringManifest {
override def identifier = 999
override def manifest(o: AnyRef) = "a"
override def toBinary(o: AnyRef) = o match {

View file

@ -15,6 +15,7 @@ package org.apache.pekko.cluster
import java.util.concurrent.atomic.AtomicBoolean
import scala.annotation.nowarn
import scala.concurrent.duration._
import scala.util.control.NonFatal
@ -24,21 +25,20 @@ import pekko.actor.ActorSystem
import pekko.actor.Props
import pekko.testkit.TestKit.awaitCond
import pekko.testkit.TestKit.shutdownActorSystem
import pekko.util.unused
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec
import com.typesafe.config.ConfigFactory
class FailingDowningProvider(@unused system: ActorSystem) extends DowningProvider {
class FailingDowningProvider(@nowarn("msg=never used") system: ActorSystem) extends DowningProvider {
override val downRemovalMargin: FiniteDuration = 20.seconds
override def downingActorProps: Option[Props] = {
throw new ConfigurationException("this provider never works")
}
}
class DummyDowningProvider(@unused system: ActorSystem) extends DowningProvider {
class DummyDowningProvider(@nowarn("msg=never used") system: ActorSystem) extends DowningProvider {
override val downRemovalMargin: FiniteDuration = 20.seconds
val actorPropsAccessed = new AtomicBoolean(false)

View file

@ -15,17 +15,19 @@ package org.apache.pekko.cluster
import java.util.concurrent.atomic.AtomicReference
import scala.annotation.nowarn
import org.apache.pekko
import pekko.event.EventStream
import pekko.remote.FailureDetector
import pekko.util.unused
import com.typesafe.config.Config
/**
* User controllable "puppet" failure detector.
*/
class FailureDetectorPuppet(@unused config: Config, @unused ev: EventStream) extends FailureDetector {
class FailureDetectorPuppet(@nowarn("msg=never used") config: Config, @nowarn("msg=never used") ev: EventStream)
extends FailureDetector {
sealed trait Status
object Up extends Status

View file

@ -13,6 +13,7 @@
package org.apache.pekko.discovery.aggregate
import scala.annotation.nowarn
import scala.collection.immutable
import scala.concurrent.Future
import scala.concurrent.duration._
@ -22,7 +23,6 @@ import pekko.actor.{ ActorSystem, ExtendedActorSystem }
import pekko.discovery.{ Discovery, Lookup, ServiceDiscovery }
import pekko.discovery.ServiceDiscovery.{ Resolved, ResolvedTarget }
import pekko.testkit.TestKit
import pekko.util.unused
import org.scalatest.BeforeAndAfterAll
import org.scalatest.concurrent.ScalaFutures
@ -31,7 +31,7 @@ import org.scalatest.wordspec.AnyWordSpecLike
import com.typesafe.config.{ Config, ConfigFactory }
class StubbedServiceDiscovery(@unused system: ExtendedActorSystem) extends ServiceDiscovery {
class StubbedServiceDiscovery(@nowarn("msg=never used") system: ExtendedActorSystem) extends ServiceDiscovery {
override def lookup(query: Lookup, resolveTimeout: FiniteDuration): Future[Resolved] = {
if (query.serviceName == "stubbed") {

View file

@ -31,13 +31,14 @@
package org.apache.pekko.cluster.ddata
import scala.annotation.nowarn
import scala.annotation.tailrec
import scala.collection.immutable
import org.apache.pekko
import pekko.annotation.InternalApi
import pekko.cluster.UniqueAddress
import pekko.util.{ unused, HashCode }
import pekko.util.HashCode
object ORSet {
private val _empty: ORSet[Any] = new ORSet(Map.empty, VersionVector.empty)
@ -401,7 +402,7 @@ final class ORSet[A] private[pekko] (
* [[ORSet#remove(node:org\.apache\.pekko\.cluster\.ddata\.SelfUniqueAddress*]]
* for each element, but it is more efficient.
*/
def clear(@unused node: SelfUniqueAddress): ORSet[A] = clear()
def clear(@nowarn("msg=never used") node: SelfUniqueAddress): ORSet[A] = clear()
/**
* INTERNAL API

View file

@ -13,12 +13,13 @@
package org.apache.pekko.cluster.ddata
import scala.annotation.nowarn
import org.apache.pekko
import pekko.actor.Address
import pekko.annotation.InternalApi
import pekko.cluster.Member
import pekko.cluster.UniqueAddress
import pekko.util.unused
/**
* INTERNAL API
@ -33,7 +34,7 @@ import pekko.util.unused
}
final case class PruningPerformed(obsoleteTime: Long) extends PruningState {
def isObsolete(currentTime: Long): Boolean = obsoleteTime <= currentTime
def addSeen(@unused node: Address): PruningState = this
def addSeen(@nowarn("msg=never used") node: Address): PruningState = this
def estimatedSize: Int = EstimatedSize.LongValue
}
}

View file

@ -13,6 +13,7 @@
package org.apache.pekko.cluster.ddata.protobuf
import scala.annotation.nowarn
import scala.concurrent.duration._
import org.apache.pekko
@ -34,7 +35,7 @@ import pekko.cluster.ddata.Replicator.Internal._
import pekko.cluster.ddata.VersionVector
import pekko.remote.RARP
import pekko.testkit.TestKit
import pekko.util.{ unused, ByteString }
import pekko.util.ByteString
import org.scalatest.BeforeAndAfterAll
import org.scalatest.matchers.should.Matchers
@ -265,7 +266,7 @@ class ReplicatorMessageSerializerSpec
"suppory getOrAdd" in {
var n = 0
def createValue(@unused a: Read): AnyRef = {
def createValue(@nowarn("msg=never used") a: Read): AnyRef = {
n += 1
new AnyRef {
override val toString = "v" + n

View file

@ -15,12 +15,13 @@ package org.apache.pekko.osgi
import java.util.{ Dictionary, Properties }
import scala.annotation.nowarn
import org.osgi.framework._
import org.osgi.service.log.LogService
import org.apache.pekko
import pekko.actor.{ ActorRefFactory, ActorSystem }
import pekko.util.unused
import com.typesafe.config.{ Config, ConfigFactory }
@ -129,7 +130,7 @@ abstract class ActorSystemActivator extends BundleActivator {
* @param context the bundle context
* @return the actor system name
*/
def getActorSystemName(@unused context: BundleContext): String = null
def getActorSystemName(@nowarn("msg=never used") context: BundleContext): String = null
/**
* Override this method to define a configuration for your [[pekko.actor.ActorSystem]] instance.
@ -141,6 +142,6 @@ abstract class ActorSystemActivator extends BundleActivator {
* @param context the bundle context
* @return the actor system specific configuration, ConfigFactory.empty by default
*/
def getActorSystemConfiguration(@unused context: BundleContext): Config = ConfigFactory.empty
def getActorSystemConfiguration(@nowarn("msg=never used") context: BundleContext): Config = ConfigFactory.empty
}

View file

@ -13,11 +13,12 @@
package org.apache.pekko.osgi
import scala.annotation.nowarn
import org.osgi.framework.BundleContext
import org.apache.pekko
import pekko.actor.ActorSystem
import pekko.util.unused
import com.typesafe.config.{ Config, ConfigFactory }
@ -53,7 +54,7 @@ class OsgiActorSystemFactory(
* ensuring that the default/reference configuration is loaded from the pekko-actor bundle.
* Configuration files found in pekko-actor bundle
*/
def actorSystemConfig(@unused context: BundleContext): Config = {
def actorSystemConfig(@nowarn("msg=never used") context: BundleContext): Config = {
config.withFallback(
ConfigFactory
.load(classloader)

View file

@ -13,6 +13,7 @@
package org.apache.pekko.persistence.query
import scala.annotation.nowarn
import scala.reflect.ClassTag
import org.apache.pekko
@ -20,7 +21,6 @@ import pekko.actor._
import pekko.annotation.InternalApi
import pekko.persistence.{ PersistencePlugin, PluginProvider }
import pekko.persistence.query.scaladsl.ReadJournal
import pekko.util.unused
import com.typesafe.config.{ Config, ConfigFactory }
@ -73,7 +73,7 @@ class PersistenceQuery(system: ExtendedActorSystem)
* read journal configuration entry.
*/
final def getReadJournalFor[T <: javadsl.ReadJournal](
@unused clazz: Class[T],
@nowarn("msg=never used") clazz: Class[T],
readJournalPluginId: String,
readJournalPluginConfig: Config): T =
pluginFor(readJournalPluginId, readJournalPluginConfig).javadslPlugin.asInstanceOf[T]

View file

@ -13,11 +13,12 @@
package org.apache.pekko.persistence.query
import scala.annotation.nowarn
import org.apache.pekko
import pekko.NotUsed
import pekko.actor.ExtendedActorSystem
import pekko.stream.scaladsl.Source
import pekko.util.unused
import com.typesafe.config.{ Config, ConfigFactory }
@ -77,13 +78,16 @@ class DummyReadJournalProvider(dummyValue: String) extends ReadJournalProvider {
javaReadJournal
}
class DummyReadJournalProvider2(@unused sys: ExtendedActorSystem) extends DummyReadJournalProvider
class DummyReadJournalProvider2(@nowarn("msg=never used") sys: ExtendedActorSystem) extends DummyReadJournalProvider
class DummyReadJournalProvider3(@unused sys: ExtendedActorSystem, @unused conf: Config) extends DummyReadJournalProvider
class DummyReadJournalProvider3(@nowarn("msg=never used") sys: ExtendedActorSystem,
@nowarn("msg=never used") conf: Config) extends DummyReadJournalProvider
class DummyReadJournalProvider4(@unused sys: ExtendedActorSystem, @unused conf: Config, @unused confPath: String)
class DummyReadJournalProvider4(@nowarn("msg=never used") sys: ExtendedActorSystem,
@nowarn("msg=never used") conf: Config, @nowarn("msg=never used") confPath: String)
extends DummyReadJournalProvider
class DummyReadJournalProvider5(@unused sys: ExtendedActorSystem) extends DummyReadJournalProvider
class DummyReadJournalProvider5(@nowarn("msg=never used") sys: ExtendedActorSystem) extends DummyReadJournalProvider
class CustomDummyReadJournalProvider5(@unused sys: ExtendedActorSystem) extends DummyReadJournalProvider("custom")
class CustomDummyReadJournalProvider5(@nowarn("msg=never used") sys: ExtendedActorSystem)
extends DummyReadJournalProvider("custom")

View file

@ -13,6 +13,7 @@
package org.apache.pekko.persistence.journal
import scala.annotation.nowarn
import scala.concurrent.duration._
import org.apache.pekko
@ -21,7 +22,6 @@ import pekko.persistence._
import pekko.persistence.JournalProtocol._
import pekko.persistence.scalatest.{ MayVerb, OptionalTests }
import pekko.testkit._
import pekko.util.unused
import com.typesafe.config._
@ -79,7 +79,7 @@ abstract class JournalSpec(config: Config)
* test case. `pid` is the `persistenceId` that will be used in the test.
* This method may be needed to clean pre-existing events from the log.
*/
def preparePersistenceId(@unused pid: String): Unit = ()
def preparePersistenceId(@nowarn("msg=never used") pid: String): Unit = ()
/**
* Implementation may override and return false if it does not

View file

@ -13,6 +13,7 @@
package org.apache.pekko.persistence.testkit
import scala.annotation.nowarn
import scala.collection.immutable
import scala.concurrent.Future
import scala.util.Try
@ -26,7 +27,6 @@ import pekko.persistence.journal.Tagged
import pekko.persistence.snapshot.SnapshotStore
import pekko.persistence.testkit.internal.{ InMemStorageExtension, SnapshotStorageEmulatorExtension }
import pekko.persistence.testkit.internal.CurrentTime
import pekko.util.unused
import com.typesafe.config.{ Config, ConfigFactory }
@ -36,7 +36,8 @@ import com.typesafe.config.{ Config, ConfigFactory }
* Persistence testkit plugin for events.
*/
@InternalApi
class PersistenceTestKitPlugin(@unused cfg: Config, cfgPath: String) extends AsyncWriteJournal with ActorLogging {
class PersistenceTestKitPlugin(@nowarn("msg=never used") cfg: Config, cfgPath: String) extends AsyncWriteJournal
with ActorLogging {
private final val storage = {
log.debug("Using in memory storage [{}] for test kit journal", cfgPath)
@ -145,7 +146,7 @@ class PersistenceTestKitSnapshotPlugin(
// providing this parameter in first position as unused
// because Persistence extension that instantiates the plugins
// does not support constructors without it
@unused cfg: Config,
@nowarn("msg=never used") cfg: Config,
cfgPath: String
) extends SnapshotStore {

View file

@ -12,6 +12,7 @@
*/
package org.apache.pekko.persistence.testkit.query.scaladsl
import scala.annotation.nowarn
import scala.collection.immutable
import org.apache.pekko
@ -40,7 +41,6 @@ import pekko.persistence.testkit.query.internal.EventsBySliceStage
import pekko.persistence.testkit.query.internal.EventsByTagStage
import pekko.persistence.typed.PersistenceId
import pekko.stream.scaladsl.Source
import pekko.util.unused
import org.slf4j.LoggerFactory
@ -50,7 +50,8 @@ object PersistenceTestKitReadJournal {
val Identifier = "pekko.persistence.testkit.query"
}
final class PersistenceTestKitReadJournal(system: ExtendedActorSystem, @unused config: Config, configPath: String)
final class PersistenceTestKitReadJournal(system: ExtendedActorSystem, @nowarn("msg=never used") config: Config,
configPath: String)
extends ReadJournal
with EventsByPersistenceIdQuery
with CurrentEventsByPersistenceIdQuery

View file

@ -15,6 +15,7 @@ package org.apache.pekko.persistence.typed.scaladsl
import java.util.concurrent.atomic.AtomicInteger
import scala.annotation.nowarn
import scala.concurrent.duration._
import scala.util.Success
import scala.util.Try
@ -38,7 +39,6 @@ import pekko.persistence.typed.SnapshotCompleted
import pekko.persistence.typed.SnapshotFailed
import pekko.persistence.typed.SnapshotSelectionCriteria
import pekko.serialization.jackson.CborSerializable
import pekko.util.unused
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpecLike
@ -59,7 +59,7 @@ object EventSourcedBehaviorRetentionSpec extends Matchers {
final case class State(value: Int, history: Vector[Int]) extends CborSerializable
def counter(
@unused ctx: ActorContext[Command],
@nowarn("msg=never used") ctx: ActorContext[Command],
persistenceId: PersistenceId,
probe: Option[ActorRef[(State, Event)]] = None,
snapshotSignalProbe: Option[ActorRef[WrappedSignal]] = None,

View file

@ -17,6 +17,8 @@ import java.util.Optional
import java.util.UUID
import java.util.concurrent.atomic.AtomicInteger
import scala.annotation.nowarn
import org.apache.pekko
import pekko.actor.typed
import pekko.actor.typed.ActorRef
@ -53,7 +55,6 @@ import pekko.persistence.typed.scaladsl._
import pekko.persistence.typed.scaladsl.{ Recovery => TypedRecovery }
import pekko.persistence.typed.scaladsl.RetentionCriteria
import pekko.util.ConstantFun
import pekko.util.unused
import org.slf4j.LoggerFactory
@ -250,7 +251,7 @@ private[pekko] final case class EventSourcedBehaviorImpl[Command, Event, State](
}
@InternalStableApi
private[pekko] def initialize(@unused context: ActorContext[_]): Unit = ()
private[pekko] def initialize(@nowarn("msg=never used") context: ActorContext[_]): Unit = ()
override def receiveSignal(
handler: PartialFunction[(State, Signal), Unit]): EventSourcedBehavior[Command, Event, State] =

View file

@ -13,6 +13,7 @@
package org.apache.pekko.persistence.typed.internal
import scala.annotation.nowarn
import scala.collection.immutable
import org.apache.pekko
@ -29,7 +30,7 @@ import pekko.annotation.InternalStableApi
import pekko.persistence._
import pekko.persistence.JournalProtocol.ReplayMessages
import pekko.persistence.SnapshotProtocol.LoadSnapshot
import pekko.util.{ unused, OptionVal }
import pekko.util.OptionVal
/** INTERNAL API */
@InternalApi
@ -87,9 +88,9 @@ private[pekko] trait JournalInteractions[C, E, S] {
@InternalStableApi
private[pekko] def onWriteInitiated(
@unused ctx: ActorContext[_],
@unused cmd: Any,
@unused repr: PersistentRepr): Unit = ()
@nowarn("msg=never used") ctx: ActorContext[_],
@nowarn("msg=never used") cmd: Any,
@nowarn("msg=never used") repr: PersistentRepr): Unit = ()
protected def internalPersistAll(
ctx: ActorContext[_],
@ -128,9 +129,9 @@ private[pekko] trait JournalInteractions[C, E, S] {
@InternalStableApi
private[pekko] def onWritesInitiated(
@unused ctx: ActorContext[_],
@unused cmd: Any,
@unused repr: immutable.Seq[PersistentRepr]): Unit = ()
@nowarn("msg=never used") ctx: ActorContext[_],
@nowarn("msg=never used") cmd: Any,
@nowarn("msg=never used") repr: immutable.Seq[PersistentRepr]): Unit = ()
protected def replayEvents(fromSeqNr: Long, toSeqNr: Long): Unit = {
setup.internalLogger.debug2("Replaying events: from: {}, to: {}", fromSeqNr, toSeqNr)

View file

@ -13,6 +13,7 @@
package org.apache.pekko.persistence.typed.internal
import scala.annotation.nowarn
import scala.collection.immutable
import scala.concurrent.duration._
import scala.util.control.NonFatal
@ -39,7 +40,6 @@ import pekko.persistence.typed.internal.Running.WithSeqNrAccessible
import pekko.persistence.typed.internal.Running.startReplicationStream
import pekko.util.OptionVal
import pekko.util.PrettyDuration._
import pekko.util.unused
/**
* *
@ -97,11 +97,12 @@ private[pekko] final class ReplayingEvents[C, E, S](
onRecoveryStart(setup.context)
@InternalStableApi
def onRecoveryStart(@unused context: ActorContext[_]): Unit = ()
def onRecoveryStart(@nowarn("msg=never used") context: ActorContext[_]): Unit = ()
@InternalStableApi
def onRecoveryComplete(@unused context: ActorContext[_]): Unit = ()
def onRecoveryComplete(@nowarn("msg=never used") context: ActorContext[_]): Unit = ()
@InternalStableApi
def onRecoveryFailed(@unused context: ActorContext[_], @unused reason: Throwable, @unused event: Option[Any]): Unit =
def onRecoveryFailed(@nowarn("msg=never used") context: ActorContext[_], @nowarn("msg=never used") reason: Throwable,
@nowarn("msg=never used") event: Option[Any]): Unit =
()
override def onMessage(msg: InternalProtocol): Behavior[InternalProtocol] = {

View file

@ -13,6 +13,8 @@
package org.apache.pekko.persistence.typed.internal
import scala.annotation.nowarn
import org.apache.pekko
import pekko.actor.typed.Behavior
import pekko.actor.typed.internal.PoisonPill
@ -24,7 +26,6 @@ import pekko.persistence.SnapshotProtocol.LoadSnapshotFailed
import pekko.persistence.SnapshotProtocol.LoadSnapshotResult
import pekko.persistence.typed.{ RecoveryFailed, ReplicaId }
import pekko.persistence.typed.internal.EventSourcedBehaviorImpl.{ GetSeenSequenceNr, GetState }
import pekko.util.unused
/**
* INTERNAL API
@ -119,9 +120,10 @@ private[pekko] class ReplayingSnapshot[C, E, S](override val setup: BehaviorSetu
}
@InternalStableApi
def onRecoveryStart(@unused context: ActorContext[_]): Unit = ()
def onRecoveryStart(@nowarn("msg=never used") context: ActorContext[_]): Unit = ()
@InternalStableApi
def onRecoveryFailed(@unused context: ActorContext[_], @unused reason: Throwable): Unit = ()
def onRecoveryFailed(@nowarn("msg=never used") context: ActorContext[_], @nowarn("msg=never used") reason: Throwable)
: Unit = ()
private def onRecoveryTick(snapshot: Boolean): Behavior[InternalProtocol] =
if (snapshot) {

View file

@ -13,12 +13,13 @@
package org.apache.pekko.persistence.typed.internal
import scala.annotation.nowarn
import org.apache.pekko
import pekko.actor.typed.Behavior
import pekko.actor.typed.internal.PoisonPill
import pekko.actor.typed.scaladsl.{ ActorContext, Behaviors }
import pekko.annotation.{ InternalApi, InternalStableApi }
import pekko.util.unused
/**
* INTERNAL API
@ -78,7 +79,7 @@ private[pekko] class RequestingRecoveryPermit[C, E, S](override val setup: Behav
}
@InternalStableApi
def onRequestingRecoveryPermit(@unused context: ActorContext[_]): Unit = ()
def onRequestingRecoveryPermit(@nowarn("msg=never used") context: ActorContext[_]): Unit = ()
private def becomeReplaying(receivedPoisonPill: Boolean): Behavior[InternalProtocol] = {
setup.internalLogger.debug(s"Initializing snapshot recovery: {}", setup.recovery)

View file

@ -19,6 +19,7 @@ import java.time.ZoneId
import java.time.format.DateTimeFormatter
import java.util.concurrent.atomic.AtomicReference
import scala.annotation.nowarn
import scala.annotation.tailrec
import scala.collection.immutable
@ -74,7 +75,6 @@ import pekko.stream.scaladsl.Source
import pekko.stream.typed.scaladsl.ActorFlow
import pekko.util.OptionVal
import pekko.util.Timeout
import pekko.util.unused
/**
* INTERNAL API
@ -1062,16 +1062,18 @@ private[pekko] object Running {
@InternalStableApi
private[pekko] def onWriteFailed(
@unused ctx: ActorContext[_],
@unused reason: Throwable,
@unused event: PersistentRepr): Unit = ()
@nowarn("msg=never used") ctx: ActorContext[_],
@nowarn("msg=never used") reason: Throwable,
@nowarn("msg=never used") event: PersistentRepr): Unit = ()
@InternalStableApi
private[pekko] def onWriteRejected(
@unused ctx: ActorContext[_],
@unused reason: Throwable,
@unused event: PersistentRepr): Unit = ()
@nowarn("msg=never used") ctx: ActorContext[_],
@nowarn("msg=never used") reason: Throwable,
@nowarn("msg=never used") event: PersistentRepr): Unit = ()
@InternalStableApi
private[pekko] def onWriteSuccess(@unused ctx: ActorContext[_], @unused event: PersistentRepr): Unit = ()
private[pekko] def onWriteSuccess(@nowarn("msg=never used") ctx: ActorContext[_],
@nowarn("msg=never used") event: PersistentRepr): Unit = ()
@InternalStableApi
private[pekko] def onWriteDone(@unused ctx: ActorContext[_], @unused event: PersistentRepr): Unit = ()
private[pekko] def onWriteDone(@nowarn("msg=never used") ctx: ActorContext[_],
@nowarn("msg=never used") event: PersistentRepr): Unit = ()
}

View file

@ -16,6 +16,7 @@ package org.apache.pekko.persistence.typed.javadsl
import java.util.Collections
import java.util.Optional
import scala.annotation.nowarn
import scala.jdk.OptionConverters._
import org.apache.pekko
@ -28,7 +29,6 @@ import pekko.annotation.InternalApi
import pekko.persistence.typed._
import pekko.persistence.typed.EventAdapter
import pekko.persistence.typed.internal._
import pekko.util.unused
import com.typesafe.config.Config
@ -161,7 +161,8 @@ abstract class EventSourcedBehavior[Command, Event, State] private[pekko] (
* @return `true` if snapshot should be saved at the given `state`, `event` and `sequenceNr` when the event has
* been successfully persisted
*/
def shouldSnapshot(@unused state: State, @unused event: Event, @unused sequenceNr: Long): Boolean = false
def shouldSnapshot(@nowarn("msg=never used") state: State, @nowarn("msg=never used") event: Event,
@nowarn("msg=never used") sequenceNr: Long): Boolean = false
/**
* Criteria for retention/deletion of snapshots and events.
@ -178,7 +179,7 @@ abstract class EventSourcedBehavior[Command, Event, State] private[pekko] (
/**
* The `tagger` function should give event tags, which will be used in persistence query
*/
def tagsFor(@unused event: Event): java.util.Set[String] = Collections.emptySet()
def tagsFor(@nowarn("msg=never used") event: Event): java.util.Set[String] = Collections.emptySet()
/**
* Transform the event in another type before giving to the journal. Can be used to wrap events

View file

@ -13,6 +13,8 @@
package org.apache.pekko.persistence.typed.state.internal
import scala.annotation.nowarn
import org.apache.pekko
import pekko.actor.typed
import pekko.actor.typed.ActorRef
@ -32,7 +34,6 @@ import pekko.persistence.state.scaladsl.GetObjectResult
import pekko.persistence.typed.PersistenceId
import pekko.persistence.typed.SnapshotAdapter
import pekko.persistence.typed.state.scaladsl._
import pekko.util.unused
import org.slf4j.LoggerFactory
@ -158,7 +159,7 @@ private[pekko] final case class DurableStateBehaviorImpl[Command, State](
}
@InternalStableApi
private[pekko] def initialize(@unused context: ActorContext[_]): Unit = ()
private[pekko] def initialize(@nowarn("msg=never used") context: ActorContext[_]): Unit = ()
override def receiveSignal(handler: PartialFunction[(State, Signal), Unit]): DurableStateBehavior[Command, State] =
copy(signalHandler = handler)

View file

@ -13,6 +13,7 @@
package org.apache.pekko.persistence.typed.state.internal
import scala.annotation.nowarn
import scala.util.Failure
import scala.util.Success
@ -28,7 +29,6 @@ import pekko.annotation.InternalApi
import pekko.annotation.InternalStableApi
import pekko.persistence._
import pekko.persistence.state.scaladsl.GetObjectResult
import pekko.util.unused
/** INTERNAL API */
@InternalApi
@ -86,9 +86,11 @@ private[pekko] trait DurableStateStoreInteractions[C, S] {
// FIXME These hook methods are for Telemetry. What more parameters are needed? persistenceId?
@InternalStableApi
private[pekko] def onWriteInitiated(@unused ctx: ActorContext[_], @unused cmd: Any): Unit = ()
private[pekko] def onWriteInitiated(@nowarn("msg=never used") ctx: ActorContext[_],
@nowarn("msg=never used") cmd: Any): Unit = ()
private[pekko] def onDeleteInitiated(@unused ctx: ActorContext[_], @unused cmd: Any): Unit = ()
private[pekko] def onDeleteInitiated(@nowarn("msg=never used") ctx: ActorContext[_],
@nowarn("msg=never used") cmd: Any): Unit = ()
protected def requestRecoveryPermit(): Unit = {
setup.persistence.recoveryPermitter.tell(RecoveryPermitter.RequestRecoveryPermit, setup.selfClassic)

View file

@ -13,6 +13,7 @@
package org.apache.pekko.persistence.typed.state.internal
import scala.annotation.nowarn
import scala.concurrent.duration._
import org.apache.pekko
@ -32,7 +33,6 @@ import pekko.persistence.typed.state.RecoveryFailed
import pekko.persistence.typed.state.internal.DurableStateBehaviorImpl.GetState
import pekko.persistence.typed.state.internal.Running.WithRevisionAccessible
import pekko.util.PrettyDuration._
import pekko.util.unused
/**
* INTERNAL API
@ -136,11 +136,12 @@ private[pekko] class Recovering[C, S](
}
@InternalStableApi
def onRecoveryStart(@unused context: ActorContext[_]): Unit = ()
def onRecoveryStart(@nowarn("msg=never used") context: ActorContext[_]): Unit = ()
@InternalStableApi
def onRecoveryComplete(@unused context: ActorContext[_]): Unit = ()
def onRecoveryComplete(@nowarn("msg=never used") context: ActorContext[_]): Unit = ()
@InternalStableApi
def onRecoveryFailed(@unused context: ActorContext[_], @unused reason: Throwable): Unit = ()
def onRecoveryFailed(@nowarn("msg=never used") context: ActorContext[_], @nowarn("msg=never used") reason: Throwable)
: Unit = ()
private def onRecoveryTimeout(): Behavior[InternalProtocol] = {
val ex = new RecoveryTimedOut(s"Recovery timed out, didn't get state within ${setup.settings.recoveryTimeout}")

View file

@ -13,12 +13,13 @@
package org.apache.pekko.persistence.typed.state.internal
import scala.annotation.nowarn
import org.apache.pekko
import pekko.actor.typed.Behavior
import pekko.actor.typed.internal.PoisonPill
import pekko.actor.typed.scaladsl.{ ActorContext, Behaviors }
import pekko.annotation.{ InternalApi, InternalStableApi }
import pekko.util.unused
/**
* INTERNAL API
@ -77,7 +78,7 @@ private[pekko] class RequestingRecoveryPermit[C, S](override val setup: Behavior
}
@InternalStableApi
def onRequestingRecoveryPermit(@unused context: ActorContext[_]): Unit = ()
def onRequestingRecoveryPermit(@nowarn("msg=never used") context: ActorContext[_]): Unit = ()
private def becomeRecovering(receivedPoisonPill: Boolean): Behavior[InternalProtocol] = {
setup.internalLogger.debug(s"Initializing recovery")

View file

@ -13,6 +13,7 @@
package org.apache.pekko.persistence.typed.state.internal
import scala.annotation.nowarn
import scala.annotation.tailrec
import scala.collection.immutable
@ -29,7 +30,6 @@ import pekko.annotation.InternalApi
import pekko.annotation.InternalStableApi
import pekko.persistence.typed.state.internal.DurableStateBehaviorImpl.GetState
import pekko.persistence.typed.state.scaladsl.Effect
import pekko.util.unused
/**
* INTERNAL API
@ -73,7 +73,8 @@ private[pekko] object Running {
def nextRevision(): RunningState[State, Command] =
copy(revision = revision + 1)
def applyState(@unused setup: BehaviorSetup[Command, State], updated: State): RunningState[State, Command] = {
def applyState(@nowarn("msg=never used") setup: BehaviorSetup[Command, State], updated: State)
: RunningState[State, Command] = {
copy(state = updated)
}
}
@ -360,8 +361,9 @@ private[pekko] object Running {
}
@InternalStableApi
private[pekko] def onWriteFailed(@unused ctx: ActorContext[_], @unused reason: Throwable): Unit = ()
private[pekko] def onWriteFailed(@nowarn("msg=never used") ctx: ActorContext[_],
@nowarn("msg=never used") reason: Throwable): Unit = ()
@InternalStableApi
private[pekko] def onWriteSuccess(@unused ctx: ActorContext[_]): Unit = ()
private[pekko] def onWriteSuccess(@nowarn("msg=never used") ctx: ActorContext[_]): Unit = ()
}

View file

@ -13,6 +13,7 @@
package org.apache.pekko.persistence.fsm
import scala.annotation.nowarn
import scala.collection.mutable
import scala.concurrent.duration.FiniteDuration
import scala.jdk.DurationConverters._
@ -24,7 +25,6 @@ import pekko.actor._
import pekko.japi.function.{ Effect, Function2, Predicate, Predicate2, Procedure, Procedure2, Procedure3 }
import pekko.japi.pf.{ FSMTransitionHandlerBuilder, UnitMatch, UnitPFBuilder }
import pekko.routing.{ Deafen, Listen, Listeners }
import pekko.util.unused
/**
* Finite State Machine actor trait. Use as follows:
@ -537,7 +537,7 @@ trait PersistentFSMBase[S, D, E] extends Actor with Listeners with ActorLogging
processEvent(event, source)
}
private[pekko] def processEvent(event: Event, @unused source: AnyRef): Unit = {
private[pekko] def processEvent(event: Event, @nowarn("msg=never used") source: AnyRef): Unit = {
val stateFunc = stateFunctions(currentState.stateName)
val nextState = if (stateFunc.isDefinedAt(event)) {
stateFunc(event)

View file

@ -13,12 +13,13 @@
package org.apache.pekko.persistence.journal.leveldb
import scala.annotation.nowarn
import org.iq80.leveldb.DBIterator
import org.apache.pekko
import pekko.actor.Actor
import pekko.util.ByteString.UTF_8
import pekko.util.unused
/**
* INTERNAL API.
@ -80,7 +81,7 @@ private[persistence] trait LeveldbIdMapping extends Actor { this: LeveldbStore =
numericId
}
override protected def newPersistenceIdAdded(@unused id: String): Unit = ()
override protected def newPersistenceIdAdded(@nowarn("msg=never used") id: String): Unit = ()
override def preStart(): Unit = {
idMap = readIdMap()

View file

@ -13,6 +13,7 @@
package org.apache.pekko.persistence.state
import scala.annotation.nowarn
import scala.reflect.ClassTag
import org.apache.pekko
@ -27,7 +28,6 @@ import pekko.persistence.Persistence
import pekko.persistence.PersistencePlugin
import pekko.persistence.PluginProvider
import pekko.persistence.state.scaladsl.DurableStateStore
import pekko.util.unused
import com.typesafe.config.Config
@ -96,7 +96,7 @@ class DurableStateStoreRegistry(system: ExtendedActorSystem)
* configuration entry.
*/
final def getDurableStateStoreFor[T <: javadsl.DurableStateStore[_]](
@unused clazz: Class[T], // FIXME generic Class could be problematic in Java
@nowarn("msg=never used") clazz: Class[T], // FIXME generic Class could be problematic in Java
pluginId: String): T = {
pluginFor(pluginIdOrDefault(pluginId), pluginConfig(pluginId)).javadslPlugin.asInstanceOf[T]
}

View file

@ -15,6 +15,7 @@ package org.apache.pekko.persistence
import java.io.File
import scala.annotation.nowarn
import scala.concurrent.Await
import scala.concurrent.duration._
@ -24,7 +25,6 @@ import org.apache.pekko
import pekko.actor._
import pekko.persistence.journal.{ EventAdapter, EventSeq }
import pekko.testkit.TestProbe
import pekko.util.unused
import org.scalatest.BeforeAndAfterAll
import org.scalatest.matchers.should.Matchers
@ -42,7 +42,7 @@ object EndToEndEventAdapterSpec {
case class JSON(payload: Any)
class AEndToEndAdapter(@unused system: ExtendedActorSystem) extends EventAdapter {
class AEndToEndAdapter(@nowarn("msg=never used") system: ExtendedActorSystem) extends EventAdapter {
override def manifest(event: Any): String = event.getClass.getCanonicalName
override def toJournal(event: Any): Any =
@ -55,7 +55,7 @@ object EndToEndEventAdapterSpec {
case _ => EventSeq.empty
}
}
class NewAEndToEndAdapter(@unused system: ExtendedActorSystem) extends EventAdapter {
class NewAEndToEndAdapter(@nowarn("msg=never used") system: ExtendedActorSystem) extends EventAdapter {
override def manifest(event: Any): String = event.getClass.getCanonicalName
override def toJournal(event: Any): Any =
@ -68,7 +68,7 @@ object EndToEndEventAdapterSpec {
case _ => EventSeq.empty
}
}
class BEndToEndAdapter(@unused system: ExtendedActorSystem) extends EventAdapter {
class BEndToEndAdapter(@nowarn("msg=never used") system: ExtendedActorSystem) extends EventAdapter {
override def manifest(event: Any): String = event.getClass.getCanonicalName
override def toJournal(event: Any): Any =
@ -81,7 +81,7 @@ object EndToEndEventAdapterSpec {
case _ => EventSeq.empty
}
}
class NewBEndToEndAdapter(@unused system: ExtendedActorSystem) extends EventAdapter {
class NewBEndToEndAdapter(@nowarn("msg=never used") system: ExtendedActorSystem) extends EventAdapter {
override def manifest(event: Any): String = event.getClass.getCanonicalName
override def toJournal(event: Any): Any =
@ -95,7 +95,8 @@ object EndToEndEventAdapterSpec {
}
}
class EndToEndAdapterActor(name: String, override val journalPluginId: String, @unused probe: Option[ActorRef])
class EndToEndAdapterActor(name: String, override val journalPluginId: String,
@nowarn("msg=never used") probe: Option[ActorRef])
extends NamedPersistentActor(name)
with PersistentActor {

View file

@ -13,11 +13,12 @@
package org.apache.pekko.persistence
import scala.annotation.nowarn
import org.apache.pekko
import pekko.actor.Actor
import pekko.persistence.journal.inmem.InmemJournal
import pekko.testkit.ImplicitSender
import pekko.util.unused
import com.typesafe.config.Config
@ -34,7 +35,8 @@ object LoadPluginSpec {
object JournalWithStartupNotification {
final case class Started(configPath: String)
}
class JournalWithStartupNotification(@unused config: Config, configPath: String) extends InmemJournal {
class JournalWithStartupNotification(@nowarn("msg=never used") config: Config, configPath: String)
extends InmemJournal {
context.system.eventStream.publish(JournalWithStartupNotification.Started(configPath))
}
}

View file

@ -13,6 +13,7 @@
package org.apache.pekko.persistence
import scala.annotation.nowarn
import scala.concurrent.duration._
import scala.reflect.ClassTag
@ -21,7 +22,6 @@ import pekko.actor.{ Actor, ActorRef, OneForOneStrategy, Props }
import pekko.actor.SupervisorStrategy.Resume
import pekko.persistence.journal.SteppingInmemJournal
import pekko.testkit.ImplicitSender
import pekko.util.unused
import com.typesafe.config.Config
@ -185,7 +185,7 @@ object PersistentActorStashingSpec {
case _ => // ignore
}
def stashWithinHandler(@unused evt: Evt) = {
def stashWithinHandler(@nowarn("msg=never used") evt: Evt) = {
stash()
}

View file

@ -13,6 +13,7 @@
package org.apache.pekko.remote
import scala.annotation.nowarn
import scala.concurrent.duration._
import testkit.MultiNodeConfig
@ -22,7 +23,6 @@ import pekko.actor.Actor
import pekko.actor.ActorRef
import pekko.actor.Props
import pekko.actor.Terminated
import pekko.util.unused
import com.typesafe.config.ConfigFactory
@ -59,7 +59,7 @@ object NewRemoteActorSpec {
}
}
class SomeActorWithParam(@unused ignored: String) extends Actor {
class SomeActorWithParam(@nowarn("msg=never used") ignored: String) extends Actor {
def receive = {
case "identify" => sender() ! self
}

View file

@ -29,7 +29,6 @@ import pekko.event.EventStream
import pekko.remote.testconductor.RoleName
import pekko.remote.testkit.MultiNodeConfig
import pekko.testkit._
import pekko.util.unused
import com.typesafe.config.Config
import com.typesafe.config.ConfigFactory
@ -71,7 +70,8 @@ object TransportFailSpec {
private val fdAvailable = new AtomicBoolean(true)
// FD that will fail when `fdAvailable` flag is false
class TestFailureDetector(@unused config: Config, @unused ev: EventStream) extends FailureDetector {
class TestFailureDetector(@nowarn("msg=never used") config: Config, @nowarn("msg=never used") ev: EventStream)
extends FailureDetector {
@volatile private var active = false
override def heartbeat(): Unit = {

View file

@ -13,6 +13,7 @@
package org.apache.pekko.remote
import scala.annotation.nowarn
import scala.util.control.NonFatal
import org.apache.pekko
@ -22,7 +23,6 @@ import pekko.protobufv3.internal.ByteString
import pekko.remote.WireFormats._
import pekko.remote.artery.{ EnvelopeBuffer, HeaderBuilder, OutboundEnvelope }
import pekko.serialization._
import pekko.util.unused
/**
* INTERNAL API
@ -103,8 +103,8 @@ private[pekko] object MessageSerializer {
}
def deserializeForArtery(
@unused system: ExtendedActorSystem,
@unused originUid: Long,
@nowarn("msg=never used") system: ExtendedActorSystem,
@nowarn("msg=never used") originUid: Long,
serialization: Serialization,
serializer: Int,
classManifest: String,

View file

@ -46,7 +46,6 @@ import pekko.remote.serialization.ActorRefResolveThreadLocalCache
import pekko.serialization.Serialization
import pekko.util.ErrorMessages
import pekko.util.OptionVal
import pekko.util.unused
/**
* INTERNAL API
@ -373,7 +372,8 @@ private[pekko] class RemoteActorRefProvider(
warnOnUnsafe(s"Remote deploy of [$path] is not allowed, falling back to local.")
/** Override to add any additional checks if using `RemoteActorRefProvider` as a superclass. */
protected def shouldCreateRemoteActorRef(@unused system: ActorSystem, @unused address: Address): Boolean = true
protected def shouldCreateRemoteActorRef(@nowarn("msg=never used") system: ActorSystem,
@nowarn("msg=never used") address: Address): Boolean = true
def actorOf(
system: ActorSystemImpl,

View file

@ -13,6 +13,7 @@
package org.apache.pekko.remote
import scala.annotation.nowarn
import scala.collection.immutable
import scala.concurrent.Future
import scala.util.control.NoStackTrace
@ -23,7 +24,7 @@ import pekko.PekkoException
import pekko.actor._
import pekko.annotation.InternalStableApi
import pekko.event.LoggingAdapter
import pekko.util.{ unused, OptionVal }
import pekko.util.OptionVal
/**
* RemoteTransportException represents a general failure within a RemoteTransport,
@ -93,7 +94,7 @@ private[pekko] abstract class RemoteTransport(val system: ExtendedActorSystem, v
* @param cmd Command message to send to the transports.
* @return A Future that indicates when the message was successfully handled or dropped.
*/
def managementCommand(@unused cmd: Any): Future[Boolean] = { Future.successful(false) }
def managementCommand(@nowarn("msg=never used") cmd: Any): Future[Boolean] = { Future.successful(false) }
/**
* A Logger that can be used to log issues that may occur

View file

@ -26,7 +26,6 @@ import pekko.dispatch.sysmsg.{ DeathWatchNotification, Watch }
import pekko.event.AddressTerminatedTopic
import pekko.remote.artery.ArteryMessage
import pekko.remote.artery.ArteryTransport
import pekko.util.unused
/**
* INTERNAL API
@ -219,7 +218,7 @@ private[pekko] class RemoteWatcher(
* Returns true if either has cluster or `pekko.remote.use-unsafe-remote-features-outside-cluster`
* is enabled. Can be overridden when using RemoteWatcher as a superclass.
*/
protected def shouldWatch(@unused watchee: InternalActorRef): Boolean = {
protected def shouldWatch(@nowarn("msg=never used") watchee: InternalActorRef): Boolean = {
// In this it is unnecessary if only created by RARP, but cluster needs it.
// Cleaner than overriding Cluster watcher addWatch/removeWatch just for one boolean test
remoteProvider.remoteSettings.UseUnsafeRemoteFeaturesWithoutCluster

View file

@ -15,6 +15,7 @@ package org.apache.pekko.remote.artery
import java.util.concurrent.TimeUnit
import scala.annotation.nowarn
import scala.concurrent.Future
import scala.concurrent.Promise
import scala.concurrent.duration._
@ -44,7 +45,6 @@ import pekko.serialization.Serializers
import pekko.stream._
import pekko.stream.stage._
import pekko.util.OptionVal
import pekko.util.unused
/**
* INTERNAL API
@ -65,7 +65,7 @@ private[remote] class Encoder(
system: ExtendedActorSystem,
outboundEnvelopePool: ObjectPool[ReusableOutboundEnvelope],
bufferPool: EnvelopeBufferPool,
@unused streamId: Int,
@nowarn("msg=never used") streamId: Int,
debugLogSend: Boolean,
version: Byte)
extends GraphStageWithMaterializedValue[
@ -643,7 +643,7 @@ private[remote] class Decoder(
* INTERNAL API
*/
private[remote] class Deserializer(
@unused inboundContext: InboundContext,
@nowarn("msg=never used") inboundContext: InboundContext,
system: ExtendedActorSystem,
bufferPool: EnvelopeBufferPool)
extends GraphStage[FlowShape[InboundEnvelope, InboundEnvelope]] {

View file

@ -13,6 +13,7 @@
package org.apache.pekko.remote.artery
import scala.annotation.nowarn
import scala.concurrent.ExecutionContext
import scala.concurrent.Future
import scala.concurrent.duration._
@ -29,7 +30,6 @@ import pekko.stream.Inlet
import pekko.stream.Outlet
import pekko.stream.stage._
import pekko.util.OptionVal
import pekko.util.unused
/**
* INTERNAL API
@ -61,7 +61,7 @@ private[remote] object OutboundHandshake {
* INTERNAL API
*/
private[remote] class OutboundHandshake(
@unused system: ActorSystem,
@nowarn("msg=never used") system: ActorSystem,
outboundContext: OutboundContext,
outboundEnvelopePool: ObjectPool[ReusableOutboundEnvelope],
timeout: FiniteDuration,

View file

@ -16,6 +16,7 @@ package org.apache.pekko.remote.artery
import java.nio.ByteBuffer
import java.util.concurrent.ConcurrentHashMap
import scala.annotation.nowarn
import scala.annotation.tailrec
import scala.util.control.NonFatal
@ -30,7 +31,6 @@ import pekko.event.Logging
import pekko.event.LoggingAdapter
import pekko.remote.RemoteActorRefProvider
import pekko.util.OptionVal
import pekko.util.unused
/**
* INTERNAL API
@ -409,7 +409,7 @@ private[remote] object RemoteInstruments {
def getLength(kl: Int): Int = kl & lengthMask
@InternalStableApi
def create(system: ExtendedActorSystem, @unused log: LoggingAdapter): Vector[RemoteInstrument] = {
def create(system: ExtendedActorSystem, @nowarn("msg=never used") log: LoggingAdapter): Vector[RemoteInstrument] = {
val c = system.settings.config
val path = "pekko.remote.artery.advanced.instruments"
import scala.jdk.CollectionConverters._

View file

@ -15,6 +15,7 @@ package org.apache.pekko.remote.artery.compress
import java.util.function.LongFunction
import scala.annotation.nowarn
import scala.annotation.tailrec
import org.agrona.collections.Long2ObjectHashMap
@ -28,7 +29,6 @@ import pekko.event.Logging
import pekko.event.LoggingAdapter
import pekko.remote.artery._
import pekko.util.OptionVal
import pekko.util.unused
/**
* INTERNAL API
@ -441,7 +441,7 @@ private[remote] abstract class InboundCompression[T >: Null](
* Add `n` occurrence for the given key and call `heavyHittedDetected` if element has become a heavy hitter.
* Empty keys are omitted.
*/
def increment(@unused remoteAddress: Address, value: T, n: Long): Unit = {
def increment(@nowarn("msg=never used") remoteAddress: Address, value: T, n: Long): Unit = {
val count = cms.addObjectAndEstimateCount(value, n)
addAndCheckIfheavyHitterDetected(value, count)
alive = true

View file

@ -13,6 +13,7 @@
package org.apache.pekko.remote.serialization
import scala.annotation.nowarn
import scala.reflect.ClassTag
import org.apache.pekko
@ -29,7 +30,6 @@ import pekko.remote.RemoteActorRef
import pekko.remote.RemoteActorRefProvider
import pekko.remote.artery.LruBoundedCache
import pekko.util.Unsafe
import pekko.util.unused
/**
* INTERNAL API: Thread local cache per actor system
@ -64,7 +64,7 @@ private[pekko] class ActorRefResolveThreadLocalCache(val system: ExtendedActorSy
override def initialValue: ActorRefResolveCache = new ActorRefResolveCache(provider)
}
def threadLocalCache(@unused provider: RemoteActorRefProvider): ActorRefResolveCache =
def threadLocalCache(@nowarn("msg=never used") provider: RemoteActorRefProvider): ActorRefResolveCache =
current.get
}

View file

@ -23,7 +23,7 @@ import pekko.actor.{ ActorRef, Address, NoSerializationVerificationNeeded }
import pekko.actor.DeadLetterSuppression
import pekko.event.LoggingAdapter
import pekko.remote.transport.AssociationHandle.HandleEventListener
import pekko.util.{ unused, ByteString }
import pekko.util.ByteString
@deprecated("Classic remoting is deprecated, use Artery", "Akka 2.6.0")
object Transport {
@ -158,7 +158,7 @@ trait Transport {
* @param cmd Command message to the transport
* @return Future that succeeds when the command was handled or dropped
*/
def managementCommand(@unused cmd: Any): Future[Boolean] = { Future.successful(false) }
def managementCommand(@nowarn("msg=never used") cmd: Any): Future[Boolean] = { Future.successful(false) }
}

View file

@ -20,7 +20,6 @@ import scala.util.control.NonFatal
import org.apache.pekko
import pekko.PekkoException
import pekko.util.unused
import io.netty.buffer.ByteBuf
import io.netty.channel.{ ChannelHandlerContext, ChannelInboundHandlerAdapter }
@ -30,15 +29,17 @@ import io.netty.channel.{ ChannelHandlerContext, ChannelInboundHandlerAdapter }
*/
private[netty] trait NettyHelpers {
protected def onConnect(@unused ctx: ChannelHandlerContext): Unit = ()
protected def onConnect(@nowarn("msg=never used") ctx: ChannelHandlerContext): Unit = ()
protected def onDisconnect(@unused ctx: ChannelHandlerContext): Unit = ()
protected def onDisconnect(@nowarn("msg=never used") ctx: ChannelHandlerContext): Unit = ()
protected def onOpen(@unused ctx: ChannelHandlerContext): Unit = ()
protected def onOpen(@nowarn("msg=never used") ctx: ChannelHandlerContext): Unit = ()
protected def onMessage(@unused ctx: ChannelHandlerContext, @unused msg: ByteBuf): Unit = ()
protected def onMessage(@nowarn("msg=never used") ctx: ChannelHandlerContext, @nowarn("msg=never used") msg: ByteBuf)
: Unit = ()
protected def onException(@unused ctx: ChannelHandlerContext, @unused e: Throwable): Unit = ()
protected def onException(@nowarn("msg=never used") ctx: ChannelHandlerContext,
@nowarn("msg=never used") e: Throwable): Unit = ()
final protected def transformException(ctx: ChannelHandlerContext, ex: Throwable): Unit = {
val cause = if (ex ne null) ex else new PekkoException("Unknown cause")

View file

@ -15,11 +15,12 @@ package org.apache.pekko.remote
import java.io.NotSerializableException
import scala.annotation.nowarn
import org.apache.pekko
import pekko.actor.{ ActorSystem, ExtendedActorSystem, RootActorPath }
import pekko.serialization.SerializerWithStringManifest
import pekko.testkit.{ PekkoSpec, TestActors, TestKit }
import pekko.util.unused
import com.typesafe.config.{ Config, ConfigFactory }
@ -31,7 +32,7 @@ object TransientSerializationErrorSpec {
object NotDeserializable
object IllegalOnDeserialize
class TestSerializer(@unused system: ExtendedActorSystem) extends SerializerWithStringManifest {
class TestSerializer(@nowarn("msg=never used") system: ExtendedActorSystem) extends SerializerWithStringManifest {
def identifier: Int = 666
def manifest(o: AnyRef): String = o match {
case ManifestNotSerializable => throw new NotSerializableException()

View file

@ -17,6 +17,7 @@ import java.nio.{ ByteBuffer, CharBuffer }
import java.nio.ByteOrder
import java.nio.charset.StandardCharsets
import scala.annotation.nowarn
import scala.concurrent.duration._
import org.apache.pekko
@ -24,7 +25,7 @@ import pekko.actor.{ ActorRef, ActorSystem, ExtendedActorSystem, InternalActorRe
import pekko.event._
import pekko.testkit.{ EventFilter, PekkoSpec, TestProbe }
import pekko.testkit.TestEvent.Mute
import pekko.util.{ unused, OptionVal }
import pekko.util.OptionVal
class RemoteInstrumentsSerializationSpec extends PekkoSpec("pekko.loglevel = DEBUG") {
import RemoteInstrumentsSerializationSpec._
@ -136,7 +137,7 @@ class RemoteInstrumentsSerializationSpec extends PekkoSpec("pekko.loglevel = DEB
object RemoteInstrumentsSerializationSpec {
class Filter(@unused settings: ActorSystem.Settings, stream: EventStream) extends LoggingFilter {
class Filter(@nowarn("msg=never used") settings: ActorSystem.Settings, stream: EventStream) extends LoggingFilter {
stream.publish(Mute(EventFilter.debug()))
override def isErrorEnabled(logClass: Class[_], logSource: String): Boolean = true

View file

@ -13,6 +13,8 @@
package org.apache.pekko.remote.serialization
import scala.annotation.nowarn
import org.apache.pekko
import pekko.actor.Actor
import pekko.actor.ActorRef
@ -30,7 +32,6 @@ import pekko.serialization.Serialization
import pekko.serialization.SerializationExtension
import pekko.testkit.JavaSerializable
import pekko.testkit.PekkoSpec
import pekko.util.unused
import com.typesafe.config.ConfigFactory
@ -40,9 +41,10 @@ object DaemonMsgCreateSerializerAllowJavaSerializationSpec {
def receive = Actor.emptyBehavior
}
class MyActor extends EmptyActor
class MyActorWithParam(@unused ignore: String) extends EmptyActor
class MyActorWithFunParam(@unused fun: Function1[Int, Int]) extends EmptyActor
class ActorWithDummyParameter(@unused javaSerialized: DummyParameter, @unused protoSerialized: ActorRef)
class MyActorWithParam(@nowarn("msg=never used") ignore: String) extends EmptyActor
class MyActorWithFunParam(@nowarn("msg=never used") fun: Function1[Int, Int]) extends EmptyActor
class ActorWithDummyParameter(@nowarn("msg=never used") javaSerialized: DummyParameter,
@nowarn("msg=never used") protoSerialized: ActorRef)
extends EmptyActor
}

View file

@ -13,6 +13,8 @@
package org.apache.pekko.remote.serialization
import scala.annotation.nowarn
import org.apache.pekko
import pekko.actor.ExtendedActorSystem
import pekko.remote.MessageSerializer
@ -21,7 +23,6 @@ import pekko.remote.WireFormats.SerializedMessage
import pekko.remote.protobuf.v3.ProtobufProtocolV3.MyMessageV3
import pekko.serialization.SerializationExtension
import pekko.testkit.PekkoSpec
import pekko.util.unused
// those must be defined as top level classes, to have static parseFrom
case class MaliciousMessage() {}
@ -32,25 +33,25 @@ object ProtobufSerializerSpec {
}
object AnotherMessage {
def parseFrom(@unused bytes: Array[Byte]): AnotherMessage =
def parseFrom(@nowarn("msg=never used") bytes: Array[Byte]): AnotherMessage =
new AnotherMessage
}
case class AnotherMessage() {}
object AnotherMessage2 {
def parseFrom(@unused bytes: Array[Byte]): AnotherMessage2 =
def parseFrom(@nowarn("msg=never used") bytes: Array[Byte]): AnotherMessage2 =
new AnotherMessage2
}
case class AnotherMessage2() extends ProtobufSerializerSpec.AnotherInterface {}
object AnotherMessage3 {
def parseFrom(@unused bytes: Array[Byte]): AnotherMessage3 =
def parseFrom(@nowarn("msg=never used") bytes: Array[Byte]): AnotherMessage3 =
new AnotherMessage3
}
case class AnotherMessage3() extends ProtobufSerializerSpec.AnotherBase {}
object MaliciousMessage {
def parseFrom(@unused bytes: Array[Byte]): MaliciousMessage =
def parseFrom(@nowarn("msg=never used") bytes: Array[Byte]): MaliciousMessage =
new MaliciousMessage
}

View file

@ -13,9 +13,9 @@
package org.apache.pekko.serialization.jackson
import com.fasterxml.jackson.databind.JsonNode
import scala.annotation.nowarn
import org.apache.pekko.util.unused
import com.fasterxml.jackson.databind.JsonNode
/**
* Data migration of old formats to current format can
@ -51,7 +51,7 @@ abstract class JacksonMigration {
* Override this method if you have changed the class name. Return
* current class name.
*/
def transformClassName(@unused fromVersion: Int, className: String): String =
def transformClassName(@nowarn("msg=never used") fromVersion: Int, className: String): String =
className
/**

View file

@ -58,7 +58,6 @@ import pekko.actor.{
import pekko.actor.setup.Setup
import pekko.annotation.InternalStableApi
import pekko.event.{ Logging, LoggingAdapter }
import pekko.util.unused
import com.typesafe.config.Config
@ -469,7 +468,7 @@ class JacksonObjectMapperFactory {
* @param jsonFactory optional `JsonFactory` such as `CBORFactory`, for plain JSON `None` (defaults)
* can be used
*/
def newObjectMapper(@unused bindingName: String, jsonFactory: JsonFactory): ObjectMapper =
def newObjectMapper(@nowarn("msg=never used") bindingName: String, jsonFactory: JsonFactory): ObjectMapper =
JsonMapper.builder(jsonFactory).build()
/**
@ -485,7 +484,7 @@ class JacksonObjectMapperFactory {
* `pekko.serialization.jackson.deserialization-features`
*/
def overrideConfiguredModules(
@unused bindingName: String,
@nowarn("msg=never used") bindingName: String,
configuredModules: immutable.Seq[Module]): immutable.Seq[Module] =
configuredModules
@ -502,7 +501,7 @@ class JacksonObjectMapperFactory {
* `pekko.serialization.jackson.serialization-features`
*/
def overrideConfiguredSerializationFeatures(
@unused bindingName: String,
@nowarn("msg=never used") bindingName: String,
configuredFeatures: immutable.Seq[(SerializationFeature, Boolean)])
: immutable.Seq[(SerializationFeature, Boolean)] =
configuredFeatures
@ -520,7 +519,7 @@ class JacksonObjectMapperFactory {
* `pekko.serialization.jackson.deserialization-features`
*/
def overrideConfiguredDeserializationFeatures(
@unused bindingName: String,
@nowarn("msg=never used") bindingName: String,
configuredFeatures: immutable.Seq[(DeserializationFeature, Boolean)])
: immutable.Seq[(DeserializationFeature, Boolean)] =
configuredFeatures
@ -538,7 +537,7 @@ class JacksonObjectMapperFactory {
* `pekko.serialization.jackson3.enum-features`
*/
def overrideConfiguredEnumFeatures(
@unused bindingName: String,
@nowarn("msg=never used") bindingName: String,
configuredFeatures: immutable.Seq[(EnumFeature, Boolean)])
: immutable.Seq[(EnumFeature, Boolean)] =
configuredFeatures
@ -552,7 +551,7 @@ class JacksonObjectMapperFactory {
* @param configuredFeatures the list of `MapperFeatures` that were configured in `pekko.serialization.jackson.mapper-features`
*/
def overrideConfiguredMapperFeatures(
@unused bindingName: String,
@nowarn("msg=never used") bindingName: String,
configuredFeatures: immutable.Seq[(MapperFeature, Boolean)]): immutable.Seq[(MapperFeature, Boolean)] =
configuredFeatures
@ -565,7 +564,7 @@ class JacksonObjectMapperFactory {
* @param configuredFeatures the list of `JsonParser.Feature` that were configured in `pekko.serialization.jackson.json-parser-features`
*/
def overrideConfiguredJsonParserFeatures(
@unused bindingName: String,
@nowarn("msg=never used") bindingName: String,
configuredFeatures: immutable.Seq[(JsonParser.Feature, Boolean)]): immutable.Seq[(JsonParser.Feature, Boolean)] =
configuredFeatures
@ -578,7 +577,7 @@ class JacksonObjectMapperFactory {
* @param configuredFeatures the list of `JsonGenerator.Feature` that were configured in `pekko.serialization.jackson.json-generator-features`
*/
def overrideConfiguredJsonGeneratorFeatures(
@unused bindingName: String,
@nowarn("msg=never used") bindingName: String,
configuredFeatures: immutable.Seq[(JsonGenerator.Feature, Boolean)])
: immutable.Seq[(JsonGenerator.Feature, Boolean)] =
configuredFeatures
@ -592,7 +591,7 @@ class JacksonObjectMapperFactory {
* @param configuredFeatures the list of `StreamReadFeature` that were configured in `pekko.serialization.jackson.stream-read-features`
*/
def overrideConfiguredStreamReadFeatures(
@unused bindingName: String,
@nowarn("msg=never used") bindingName: String,
configuredFeatures: immutable.Seq[(StreamReadFeature, Boolean)]): immutable.Seq[(StreamReadFeature, Boolean)] =
configuredFeatures
@ -605,7 +604,7 @@ class JacksonObjectMapperFactory {
* @param configuredFeatures the list of `StreamWriterFeature` that were configured in `pekko.serialization.jackson.stream-write-features`
*/
def overrideConfiguredStreamWriteFeatures(
@unused bindingName: String,
@nowarn("msg=never used") bindingName: String,
configuredFeatures: immutable.Seq[(StreamWriteFeature, Boolean)]): immutable.Seq[(StreamWriteFeature, Boolean)] =
configuredFeatures
@ -618,7 +617,7 @@ class JacksonObjectMapperFactory {
* @param configuredFeatures the list of `JsonReadFeature` that were configured in `pekko.serialization.jackson.json-read-features`
*/
def overrideConfiguredJsonReadFeatures(
@unused bindingName: String,
@nowarn("msg=never used") bindingName: String,
configuredFeatures: immutable.Seq[(JsonReadFeature, Boolean)]): immutable.Seq[(JsonReadFeature, Boolean)] =
configuredFeatures
@ -631,7 +630,7 @@ class JacksonObjectMapperFactory {
* @param configuredFeatures the list of `JsonWriteFeature` that were configured in `pekko.serialization.jackson.json-write-features`
*/
def overrideConfiguredJsonWriteFeatures(
@unused bindingName: String,
@nowarn("msg=never used") bindingName: String,
configuredFeatures: immutable.Seq[(JsonWriteFeature, Boolean)]): immutable.Seq[(JsonWriteFeature, Boolean)] =
configuredFeatures
@ -645,7 +644,7 @@ class JacksonObjectMapperFactory {
* `pekko.serialization.jackson.visibility`
*/
def overrideConfiguredVisibility(
@unused bindingName: String,
@nowarn("msg=never used") bindingName: String,
configuredFeatures: immutable.Seq[(PropertyAccessor, JsonAutoDetect.Visibility)])
: immutable.Seq[(PropertyAccessor, JsonAutoDetect.Visibility)] =
configuredFeatures

View file

@ -13,12 +13,14 @@
package org.apache.pekko.event.slf4j
import scala.annotation.nowarn
import org.apache.pekko
import pekko.actor._
import pekko.dispatch.RequiresMessageQueue
import pekko.event.{ LogMarker, _ }
import pekko.event.Logging._
import pekko.util.{ unused, Helpers }
import pekko.util.Helpers
import org.slf4j.{ Logger => SLFLogger, LoggerFactory => SLFLoggerFactory, MDC, Marker, MarkerFactory }
@ -168,7 +170,7 @@ class Slf4jLogger extends Actor with SLF4JLogging with RequiresMessageQueue[Logg
* backend configuration (e.g. logback.xml) to filter log events before publishing
* the log events to the `eventStream`.
*/
class Slf4jLoggingFilter(@unused settings: ActorSystem.Settings, eventStream: EventStream)
class Slf4jLoggingFilter(@nowarn("msg=never used") settings: ActorSystem.Settings, eventStream: EventStream)
extends LoggingFilterWithMarker {
def isErrorEnabled(logClass: Class[_], logSource: String) =
(eventStream.logLevel >= ErrorLevel) && Logger(logClass, logSource).isErrorEnabled

View file

@ -13,6 +13,7 @@
package org.apache.pekko.stream.scaladsl
import scala.annotation.nowarn
import scala.collection.immutable
import scala.concurrent.Await
import scala.concurrent.duration._
@ -20,7 +21,6 @@ import scala.concurrent.duration._
import org.apache.pekko
import pekko.stream.testkit.{ ScriptedTest, StreamSpec, TestPublisher, TestSubscriber }
import pekko.testkit.TimingTest
import pekko.util.unused
class FlowGroupedWeightedSpec extends StreamSpec("""
pekko.stream.materializer.initial-input-buffer-size = 2
@ -29,7 +29,7 @@ class FlowGroupedWeightedSpec extends StreamSpec("""
"A GroupedWeighted" must {
"produce no group (empty sink sequence) when source is empty" in {
val input = immutable.Seq.empty
def costFn(@unused e: Int): Long = 999999L // set to an arbitrarily big value
def costFn(@nowarn("msg=never used") e: Int): Long = 999999L // set to an arbitrarily big value
val future = Source(input).groupedWeighted(1)(costFn).runWith(Sink.seq)
val result = Await.result(future, remainingOrDefault)
result should be(Seq.empty)
@ -37,7 +37,7 @@ class FlowGroupedWeightedSpec extends StreamSpec("""
"always exhaust a source into a single group if cost is 0" in {
val input = 1 to 15
def costFn(@unused e: Int): Long = 0L
def costFn(@nowarn("msg=never used") e: Int): Long = 0L
val minWeight = 1 // chose the least possible value for minWeight
val future = Source(input).groupedWeighted(minWeight)(costFn).runWith(Sink.seq)
val result = Await.result(future, remainingOrDefault)
@ -46,7 +46,7 @@ class FlowGroupedWeightedSpec extends StreamSpec("""
"exhaust source into one group if minWeight equals the accumulated cost of the source" in {
val input = 1 to 16
def costFn(@unused e: Int): Long = 1L
def costFn(@nowarn("msg=never used") e: Int): Long = 1L
val minWeight = input.length
val future = Source(input).groupedWeighted(minWeight)(costFn).runWith(Sink.seq)
val result = Await.result(future, remainingOrDefault)

Some files were not shown because too many files have changed in this diff Show more