You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pekko.apache.org by he...@apache.org on 2025/09/20 04:26:40 UTC
(pekko) 01/01: chore: Drop @unused annotation from pekko
This is an automated email from the ASF dual-hosted git repository.
hepin pushed a commit to branch noused
in repository https://gitbox.apache.org/repos/asf/pekko.git
commit de0e1d28496e35999293c24c06233748735ac189
Author: He-Pin <he...@gmail.com>
AuthorDate: Sat Sep 20 12:26:21 2025 +0800
chore: Drop @unused annotation from pekko
---
.../apache/pekko/actor/testkit/typed/Effect.scala | 4 +--
.../actor/testkit/typed/javadsl/TestProbe.scala | 7 ++--
.../org/apache/pekko/actor/ActorMailboxSpec.scala | 5 +--
.../pekko/actor/ActorWithBoundedStashSpec.scala | 8 +++--
.../org/apache/pekko/actor/FSMActorSpec.scala | 5 +--
.../org/apache/pekko/actor/PropsCreationSpec.scala | 7 ++--
.../org/apache/pekko/actor/SupervisorSpec.scala | 5 +--
.../pekko/actor/dispatch/DispatchersSpec.scala | 5 +--
.../apache/pekko/dispatch/MailboxConfigSpec.scala | 7 ++--
.../pekko/dispatch/PriorityDispatcherSpec.scala | 6 ++--
.../dispatch/StablePriorityDispatcherSpec.scala | 6 ++--
.../apache/pekko/serialization/SerializeSpec.scala | 6 ++--
.../pekko/util/BoundedBlockingQueueSpec.scala | 3 +-
.../scala/org/apache/pekko/util/ReflectSpec.scala | 5 +--
.../actor/typed/internal/StashBufferImpl.scala | 12 ++++---
.../pekko/actor/typed/internal/Supervision.scala | 9 +++---
.../pekko/actor/typed/javadsl/Behaviors.scala | 4 +--
.../pekko/actor/typed/scaladsl/AskPattern.scala | 5 +--
.../remove-scala-2.12-support.excludes | 1 +
.../org/apache/pekko/util/ByteString.scala | 2 +-
.../scala-3/org/apache/pekko/util/ByteString.scala | 4 +--
.../scala/org/apache/pekko/actor/AbstractFSM.scala | 2 +-
.../main/scala/org/apache/pekko/actor/Actor.scala | 8 ++---
.../scala/org/apache/pekko/actor/ActorCell.scala | 3 +-
.../main/scala/org/apache/pekko/actor/FSM.scala | 4 +--
.../apache/pekko/actor/RepointableActorRef.scala | 3 +-
.../apache/pekko/actor/dungeon/DeathWatch.scala | 5 +--
.../apache/pekko/dispatch/AbstractDispatcher.scala | 7 ++--
.../event/ActorClassificationUnsubscriber.scala | 5 +--
.../org/apache/pekko/event/LoggerMailbox.scala | 8 +++--
.../scala/org/apache/pekko/event/Logging.scala | 8 ++---
actor/src/main/scala/org/apache/pekko/io/Dns.scala | 3 +-
.../src/main/scala/org/apache/pekko/io/Inet.scala | 17 +++++-----
.../scala/org/apache/pekko/io/UdpConnection.scala | 6 ++--
.../apache/pekko/io/dns/DnsResourceRecords.scala | 15 +++++----
.../org/apache/pekko/pattern/AskSupport.scala | 12 ++++---
.../org/apache/pekko/pattern/PipeToSupport.scala | 4 +--
.../org/apache/pekko/routing/RouterConfig.scala | 7 ++--
.../main/scala/org/apache/pekko/util/Unused.scala | 37 ----------------------
.../metrics/ClusterMetricsRoutingSpec.scala | 3 +-
.../sharding/typed/ShardingMessageExtractor.scala | 5 +--
.../typed/internal/ClusterShardingImpl.scala | 5 +--
.../sharding/typed/javadsl/ClusterSharding.scala | 2 +-
.../org/apache/pekko/cluster/sharding/Shard.scala | 6 ++--
.../pekko/cluster/client/ClusterClientSpec.scala | 3 +-
.../org/apache/pekko/cluster/SeedNodeProcess.scala | 5 +--
.../pekko/cluster/LargeMessageClusterSpec.scala | 4 +--
.../apache/pekko/cluster/DowningProviderSpec.scala | 6 ++--
.../pekko/cluster/FailureDetectorPuppet.scala | 6 ++--
.../aggregate/AggregateServiceDiscoverySpec.scala | 4 +--
.../org/apache/pekko/cluster/ddata/ORSet.scala | 5 +--
.../apache/pekko/cluster/ddata/PruningState.scala | 5 +--
.../protobuf/ReplicatorMessageSerializerSpec.scala | 5 +--
.../apache/pekko/osgi/ActorSystemActivator.scala | 7 ++--
.../apache/pekko/osgi/OsgiActorSystemFactory.scala | 5 +--
.../pekko/persistence/query/PersistenceQuery.scala | 4 +--
.../pekko/persistence/query/DummyReadJournal.scala | 16 ++++++----
.../pekko/persistence/journal/JournalSpec.scala | 4 +--
.../testkit/PersistenceTestKitPlugin.scala | 7 ++--
.../scaladsl/PersistenceTestKitReadJournal.scala | 5 +--
.../EventSourcedBehaviorRetentionSpec.scala | 4 +--
.../typed/internal/EventSourcedBehaviorImpl.scala | 5 +--
.../typed/internal/ExternalInteractions.scala | 15 +++++----
.../typed/internal/ReplayingEvents.scala | 9 +++---
.../typed/internal/ReplayingSnapshot.scala | 8 +++--
.../typed/internal/RequestingRecoveryPermit.scala | 5 +--
.../pekko/persistence/typed/internal/Running.scala | 20 ++++++------
.../typed/javadsl/EventSourcedBehavior.scala | 7 ++--
.../state/internal/DurableStateBehaviorImpl.scala | 5 +--
.../internal/DurableStateStoreInteractions.scala | 8 +++--
.../typed/state/internal/Recovering.scala | 9 +++---
.../state/internal/RequestingRecoveryPermit.scala | 5 +--
.../persistence/typed/state/internal/Running.scala | 10 +++---
.../pekko/persistence/fsm/PersistentFSMBase.scala | 4 +--
.../journal/leveldb/LeveldbIdMapping.scala | 5 +--
.../state/DurableStateStoreRegistry.scala | 4 +--
.../persistence/EndToEndEventAdapterSpec.scala | 13 ++++----
.../apache/pekko/persistence/LoadPluginSpec.scala | 6 ++--
.../persistence/PersistentActorStashingSpec.scala | 4 +--
.../apache/pekko/remote/NewRemoteActorSpec.scala | 4 +--
.../apache/pekko/remote/TransportFailSpec.scala | 4 +--
.../apache/pekko/remote/MessageSerializer.scala | 6 ++--
.../pekko/remote/RemoteActorRefProvider.scala | 4 +--
.../org/apache/pekko/remote/RemoteTransport.scala | 5 +--
.../org/apache/pekko/remote/RemoteWatcher.scala | 3 +-
.../org/apache/pekko/remote/artery/Codecs.scala | 6 ++--
.../org/apache/pekko/remote/artery/Handshake.scala | 4 +--
.../pekko/remote/artery/RemoteInstrument.scala | 4 +--
.../artery/compress/InboundCompressions.scala | 4 +--
.../serialization/ActorRefResolveCache.scala | 4 +--
.../apache/pekko/remote/transport/Transport.scala | 4 +--
.../remote/transport/netty/NettyHelpers.scala | 13 ++++----
.../remote/TransientSerializationErrorSpec.scala | 5 +--
.../RemoteInstrumentsSerializationSpec.scala | 5 +--
...reateSerializerAllowJavaSerializationSpec.scala | 10 +++---
.../serialization/ProtobufSerializerSpec.scala | 11 ++++---
.../serialization/jackson/JacksonMigration.scala | 6 ++--
.../jackson/JacksonObjectMapperProvider.scala | 27 ++++++++--------
.../org/apache/pekko/event/slf4j/Slf4jLogger.scala | 6 ++--
.../stream/scaladsl/FlowGroupedWeightedSpec.scala | 8 ++---
.../stream/scaladsl/FlowLimitWeightedSpec.scala | 8 ++---
.../apache/pekko/stream/scaladsl/FramingSpec.scala | 6 ++--
.../pekko/stream/scaladsl/GraphUnzipWithSpec.scala | 4 +--
.../apache/pekko/stream/impl/ActorProcessor.scala | 5 +--
.../scala/org/apache/pekko/stream/impl/FanIn.scala | 5 +--
.../org/apache/pekko/stream/impl/FanOut.scala | 4 +--
.../pekko/stream/impl/TraversalBuilder.scala | 4 +--
.../org/apache/pekko/stream/impl/fusing/Ops.scala | 4 +--
.../org/apache/pekko/stream/javadsl/Flow.scala | 4 +--
.../org/apache/pekko/stream/javadsl/Graph.scala | 35 ++++++++++----------
.../org/apache/pekko/stream/javadsl/Hub.scala | 16 ++++++----
.../org/apache/pekko/stream/javadsl/Source.scala | 6 ++--
.../org/apache/pekko/stream/scaladsl/Tcp.scala | 3 +-
.../org/apache/pekko/stream/stage/GraphStage.scala | 7 ++--
.../testkit/ExplicitlyTriggeredScheduler.scala | 5 +--
115 files changed, 410 insertions(+), 377 deletions(-)
diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/Effect.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/Effect.scala
index 51f57c6514..fdf6c7b6ef 100644
--- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/Effect.scala
+++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/Effect.scala
@@ -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
}
/**
diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/TestProbe.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/TestProbe.scala
index b93c6f321d..c709d59a85 100644
--- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/TestProbe.scala
+++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/TestProbe.scala
@@ -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)
}
diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/ActorMailboxSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/ActorMailboxSpec.scala
index 2d49a608d1..d299bc7616 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/actor/ActorMailboxSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/actor/ActorMailboxSpec.scala
@@ -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])
diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/ActorWithBoundedStashSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/ActorWithBoundedStashSpec.scala
index bcc8c37e7f..45930934fa 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/actor/ActorWithBoundedStashSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/actor/ActorWithBoundedStashSpec.scala
@@ -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"
diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/FSMActorSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/FSMActorSpec.scala
index 06d8e3db39..a4cb514570 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/actor/FSMActorSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/actor/FSMActorSpec.scala
@@ -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
}
diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/PropsCreationSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/PropsCreationSpec.scala
index 0f026fcd70..5923920544 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/actor/PropsCreationSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/actor/PropsCreationSpec.scala
@@ -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
}
diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/SupervisorSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/SupervisorSpec.scala
index ee97967c38..163f8c9f87 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/actor/SupervisorSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/actor/SupervisorSpec.scala
@@ -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
}
diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/dispatch/DispatchersSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/dispatch/DispatchersSpec.scala
index d0b21786f1..d33faf98b8 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/actor/dispatch/DispatchersSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/actor/dispatch/DispatchersSpec.scala
@@ -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)
diff --git a/actor-tests/src/test/scala/org/apache/pekko/dispatch/MailboxConfigSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/dispatch/MailboxConfigSpec.scala
index 223cf259ab..ca2039c2ef 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/dispatch/MailboxConfigSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/dispatch/MailboxConfigSpec.scala
@@ -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]()
}
}
diff --git a/actor-tests/src/test/scala/org/apache/pekko/dispatch/PriorityDispatcherSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/dispatch/PriorityDispatcherSpec.scala
index 765a1ecdf1..53511f096b 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/dispatch/PriorityDispatcherSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/dispatch/PriorityDispatcherSpec.scala
@@ -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
diff --git a/actor-tests/src/test/scala/org/apache/pekko/dispatch/StablePriorityDispatcherSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/dispatch/StablePriorityDispatcherSpec.scala
index 943b28fd91..1a7c5e18a7 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/dispatch/StablePriorityDispatcherSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/dispatch/StablePriorityDispatcherSpec.scala
@@ -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
diff --git a/actor-tests/src/test/scala/org/apache/pekko/serialization/SerializeSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/serialization/SerializeSpec.scala
index 88e5517033..ba06386493 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/serialization/SerializeSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/serialization/SerializeSpec.scala
@@ -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
}
diff --git a/actor-tests/src/test/scala/org/apache/pekko/util/BoundedBlockingQueueSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/util/BoundedBlockingQueueSpec.scala
index 4045f50b61..7cbdadb269 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/util/BoundedBlockingQueueSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/util/BoundedBlockingQueueSpec.scala
@@ -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()
diff --git a/actor-tests/src/test/scala/org/apache/pekko/util/ReflectSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/util/ReflectSpec.scala
index 753bebf6a8..d3b51763c3 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/util/ReflectSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/util/ReflectSpec.scala
@@ -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)
diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/StashBufferImpl.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/StashBufferImpl.scala
index d94480e0dd..b0dc053a57 100644
--- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/StashBufferImpl.scala
+++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/StashBufferImpl.scala
@@ -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 = ()
}
diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/Supervision.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/Supervision.scala
index 56e0ca8d57..ca0344ba84 100644
--- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/Supervision.scala
+++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/Supervision.scala
@@ -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 {
diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/Behaviors.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/Behaviors.scala
index 0556652034..af15921512 100644
--- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/Behaviors.scala
+++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/Behaviors.scala
@@ -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.
diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/scaladsl/AskPattern.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/scaladsl/AskPattern.scala
index c1e5993a37..a3e813a0ff 100644
--- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/scaladsl/AskPattern.scala
+++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/scaladsl/AskPattern.scala
@@ -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 request–reply 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
}
diff --git a/actor/src/main/mima-filters/2.0.x.backwards.excludes/remove-scala-2.12-support.excludes b/actor/src/main/mima-filters/2.0.x.backwards.excludes/remove-scala-2.12-support.excludes
index 82ee634ab9..65cfc4c25b 100644
--- a/actor/src/main/mima-filters/2.0.x.backwards.excludes/remove-scala-2.12-support.excludes
+++ b/actor/src/main/mima-filters/2.0.x.backwards.excludes/remove-scala-2.12-support.excludes
@@ -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")
diff --git a/actor/src/main/scala-2.13/org/apache/pekko/util/ByteString.scala b/actor/src/main/scala-2.13/org/apache/pekko/util/ByteString.scala
index 277960a4b5..50dff2bc81 100644
--- a/actor/src/main/scala-2.13/org/apache/pekko/util/ByteString.scala
+++ b/actor/src/main/scala-2.13/org/apache/pekko/util/ByteString.scala
@@ -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,
diff --git a/actor/src/main/scala-3/org/apache/pekko/util/ByteString.scala b/actor/src/main/scala-3/org/apache/pekko/util/ByteString.scala
index 3234963538..e5698ecb1c 100644
--- a/actor/src/main/scala-3/org/apache/pekko/util/ByteString.scala
+++ b/actor/src/main/scala-3/org/apache/pekko/util/ByteString.scala
@@ -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,
diff --git a/actor/src/main/scala/org/apache/pekko/actor/AbstractFSM.scala b/actor/src/main/scala/org/apache/pekko/actor/AbstractFSM.scala
index 60d7b46424..d82d379720 100644
--- a/actor/src/main/scala/org/apache/pekko/actor/AbstractFSM.scala
+++ b/actor/src/main/scala/org/apache/pekko/actor/AbstractFSM.scala
@@ -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
diff --git a/actor/src/main/scala/org/apache/pekko/actor/Actor.scala b/actor/src/main/scala/org/apache/pekko/actor/Actor.scala
index bf5ffcf713..98924ab1e5 100644
--- a/actor/src/main/scala/org/apache/pekko/actor/Actor.scala
+++ b/actor/src/main/scala/org/apache/pekko/actor/Actor.scala
@@ -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
diff --git a/actor/src/main/scala/org/apache/pekko/actor/ActorCell.scala b/actor/src/main/scala/org/apache/pekko/actor/ActorCell.scala
index 724b09c018..011ca93f06 100644
--- a/actor/src/main/scala/org/apache/pekko/actor/ActorCell.scala
+++ b/actor/src/main/scala/org/apache/pekko/actor/ActorCell.scala
@@ -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!")
}
diff --git a/actor/src/main/scala/org/apache/pekko/actor/FSM.scala b/actor/src/main/scala/org/apache/pekko/actor/FSM.scala
index 59995474d3..190e753091 100644
--- a/actor/src/main/scala/org/apache/pekko/actor/FSM.scala
+++ b/actor/src/main/scala/org/apache/pekko/actor/FSM.scala
@@ -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)
diff --git a/actor/src/main/scala/org/apache/pekko/actor/RepointableActorRef.scala b/actor/src/main/scala/org/apache/pekko/actor/RepointableActorRef.scala
index 122cce4d33..433e7492ac 100644
--- a/actor/src/main/scala/org/apache/pekko/actor/RepointableActorRef.scala
+++ b/actor/src/main/scala/org/apache/pekko/actor/RepointableActorRef.scala
@@ -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 = ()
diff --git a/actor/src/main/scala/org/apache/pekko/actor/dungeon/DeathWatch.scala b/actor/src/main/scala/org/apache/pekko/actor/dungeon/DeathWatch.scala
index b00b1f98ba..b7353d688a 100644
--- a/actor/src/main/scala/org/apache/pekko/actor/dungeon/DeathWatch.scala
+++ b/actor/src/main/scala/org/apache/pekko/actor/dungeon/DeathWatch.scala
@@ -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 {
diff --git a/actor/src/main/scala/org/apache/pekko/dispatch/AbstractDispatcher.scala b/actor/src/main/scala/org/apache/pekko/dispatch/AbstractDispatcher.scala
index dcbac6387f..4c4e74d448 100644
--- a/actor/src/main/scala/org/apache/pekko/dispatch/AbstractDispatcher.scala
+++ b/actor/src/main/scala/org/apache/pekko/dispatch/AbstractDispatcher.scala
@@ -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())
diff --git a/actor/src/main/scala/org/apache/pekko/event/ActorClassificationUnsubscriber.scala b/actor/src/main/scala/org/apache/pekko/event/ActorClassificationUnsubscriber.scala
index 622ebce3b6..6ecf922088 100644
--- a/actor/src/main/scala/org/apache/pekko/event/ActorClassificationUnsubscriber.scala
+++ b/actor/src/main/scala/org/apache/pekko/event/ActorClassificationUnsubscriber.scala
@@ -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]
diff --git a/actor/src/main/scala/org/apache/pekko/event/LoggerMailbox.scala b/actor/src/main/scala/org/apache/pekko/event/LoggerMailbox.scala
index e9f85a8f56..6981a8c838 100644
--- a/actor/src/main/scala/org/apache/pekko/event/LoggerMailbox.scala
+++ b/actor/src/main/scala/org/apache/pekko/event/LoggerMailbox.scala
@@ -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 {
diff --git a/actor/src/main/scala/org/apache/pekko/event/Logging.scala b/actor/src/main/scala/org/apache/pekko/event/Logging.scala
index c5e08081e3..fdaf05c93f 100644
--- a/actor/src/main/scala/org/apache/pekko/event/Logging.scala
+++ b/actor/src/main/scala/org/apache/pekko/event/Logging.scala
@@ -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
diff --git a/actor/src/main/scala/org/apache/pekko/io/Dns.scala b/actor/src/main/scala/org/apache/pekko/io/Dns.scala
index 1915c1e58d..9421705247 100644
--- a/actor/src/main/scala/org/apache/pekko/io/Dns.scala
+++ b/actor/src/main/scala/org/apache/pekko/io/Dns.scala
@@ -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)
diff --git a/actor/src/main/scala/org/apache/pekko/io/Inet.scala b/actor/src/main/scala/org/apache/pekko/io/Inet.scala
index 8394b736e7..ccf28a98bd 100644
--- a/actor/src/main/scala/org/apache/pekko/io/Inet.scala
+++ b/actor/src/main/scala/org/apache/pekko/io/Inet.scala
@@ -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 = ()
}
diff --git a/actor/src/main/scala/org/apache/pekko/io/UdpConnection.scala b/actor/src/main/scala/org/apache/pekko/io/UdpConnection.scala
index a1abfb34c8..21fd6679ab 100644
--- a/actor/src/main/scala/org/apache/pekko/io/UdpConnection.scala
+++ b/actor/src/main/scala/org/apache/pekko/io/UdpConnection.scala
@@ -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
diff --git a/actor/src/main/scala/org/apache/pekko/io/dns/DnsResourceRecords.scala b/actor/src/main/scala/org/apache/pekko/io/dns/DnsResourceRecords.scala
index 362da803e9..a02d6f3ead 100644
--- a/actor/src/main/scala/org/apache/pekko/io/dns/DnsResourceRecords.scala
+++ b/actor/src/main/scala/org/apache/pekko/io/dns/DnsResourceRecords.scala
@@ -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)
}
diff --git a/actor/src/main/scala/org/apache/pekko/pattern/AskSupport.scala b/actor/src/main/scala/org/apache/pekko/pattern/AskSupport.scala
index 2cdc45ba22..37134d1f03 100644
--- a/actor/src/main/scala/org/apache/pekko/pattern/AskSupport.scala
+++ b/actor/src/main/scala/org/apache/pekko/pattern/AskSupport.scala
@@ -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 = {}
}
/**
diff --git a/actor/src/main/scala/org/apache/pekko/pattern/PipeToSupport.scala b/actor/src/main/scala/org/apache/pekko/pattern/PipeToSupport.scala
index 99817818fd..a254b8fba1 100644
--- a/actor/src/main/scala/org/apache/pekko/pattern/PipeToSupport.scala
+++ b/actor/src/main/scala/org/apache/pekko/pattern/PipeToSupport.scala
@@ -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
diff --git a/actor/src/main/scala/org/apache/pekko/routing/RouterConfig.scala b/actor/src/main/scala/org/apache/pekko/routing/RouterConfig.scala
index 052cb81527..d3b96fdeb4 100644
--- a/actor/src/main/scala/org/apache/pekko/routing/RouterConfig.scala
+++ b/actor/src/main/scala/org/apache/pekko/routing/RouterConfig.scala
@@ -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
diff --git a/actor/src/main/scala/org/apache/pekko/util/Unused.scala b/actor/src/main/scala/org/apache/pekko/util/Unused.scala
deleted file mode 100644
index ca32876027..0000000000
--- a/actor/src/main/scala/org/apache/pekko/util/Unused.scala
+++ /dev/null
@@ -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", "")
diff --git a/cluster-metrics/src/multi-jvm/scala/org/apache/pekko/cluster/metrics/ClusterMetricsRoutingSpec.scala b/cluster-metrics/src/multi-jvm/scala/org/apache/pekko/cluster/metrics/ClusterMetricsRoutingSpec.scala
index 093a328a90..ed0739250c 100644
--- a/cluster-metrics/src/multi-jvm/scala/org/apache/pekko/cluster/metrics/ClusterMetricsRoutingSpec.scala
+++ b/cluster-metrics/src/multi-jvm/scala/org/apache/pekko/cluster/metrics/ClusterMetricsRoutingSpec.scala
@@ -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
}
diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ShardingMessageExtractor.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ShardingMessageExtractor.scala
index 324af3a39e..f0838fc83f 100644
--- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ShardingMessageExtractor.scala
+++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ShardingMessageExtractor.scala
@@ -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)
diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ClusterShardingImpl.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ClusterShardingImpl.scala
index 9be9afd359..97f08acba0 100644
--- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ClusterShardingImpl.scala
+++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ClusterShardingImpl.scala
@@ -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
}
diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/javadsl/ClusterSharding.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/javadsl/ClusterSharding.scala
index 53eb355d8d..5e9accbac1 100644
--- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/javadsl/ClusterSharding.scala
+++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/javadsl/ClusterSharding.scala
@@ -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 {
diff --git a/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/Shard.scala b/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/Shard.scala
index 96bf7733bc..f5feecb9c8 100644
--- a/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/Shard.scala
+++ b/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/Shard.scala
@@ -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 = {
diff --git a/cluster-tools/src/multi-jvm/scala/org/apache/pekko/cluster/client/ClusterClientSpec.scala b/cluster-tools/src/multi-jvm/scala/org/apache/pekko/cluster/client/ClusterClientSpec.scala
index 3304caa81a..3ec43fa091 100644
--- a/cluster-tools/src/multi-jvm/scala/org/apache/pekko/cluster/client/ClusterClientSpec.scala
+++ b/cluster-tools/src/multi-jvm/scala/org/apache/pekko/cluster/client/ClusterClientSpec.scala
@@ -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(
diff --git a/cluster/src/main/scala/org/apache/pekko/cluster/SeedNodeProcess.scala b/cluster/src/main/scala/org/apache/pekko/cluster/SeedNodeProcess.scala
index a41bf90c98..9656b14020 100644
--- a/cluster/src/main/scala/org/apache/pekko/cluster/SeedNodeProcess.scala
+++ b/cluster/src/main/scala/org/apache/pekko/cluster/SeedNodeProcess.scala
@@ -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
diff --git a/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/LargeMessageClusterSpec.scala b/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/LargeMessageClusterSpec.scala
index 5f24f4bf2f..756b17ee66 100644
--- a/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/LargeMessageClusterSpec.scala
+++ b/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/LargeMessageClusterSpec.scala
@@ -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 {
diff --git a/cluster/src/test/scala/org/apache/pekko/cluster/DowningProviderSpec.scala b/cluster/src/test/scala/org/apache/pekko/cluster/DowningProviderSpec.scala
index 7cb64b96ef..8bcdb142d6 100644
--- a/cluster/src/test/scala/org/apache/pekko/cluster/DowningProviderSpec.scala
+++ b/cluster/src/test/scala/org/apache/pekko/cluster/DowningProviderSpec.scala
@@ -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)
diff --git a/cluster/src/test/scala/org/apache/pekko/cluster/FailureDetectorPuppet.scala b/cluster/src/test/scala/org/apache/pekko/cluster/FailureDetectorPuppet.scala
index 99f2385a66..eb1eb1934b 100644
--- a/cluster/src/test/scala/org/apache/pekko/cluster/FailureDetectorPuppet.scala
+++ b/cluster/src/test/scala/org/apache/pekko/cluster/FailureDetectorPuppet.scala
@@ -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
diff --git a/discovery/src/test/scala/org/apache/pekko/discovery/aggregate/AggregateServiceDiscoverySpec.scala b/discovery/src/test/scala/org/apache/pekko/discovery/aggregate/AggregateServiceDiscoverySpec.scala
index 00fd779b7e..43fd74ab81 100644
--- a/discovery/src/test/scala/org/apache/pekko/discovery/aggregate/AggregateServiceDiscoverySpec.scala
+++ b/discovery/src/test/scala/org/apache/pekko/discovery/aggregate/AggregateServiceDiscoverySpec.scala
@@ -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") {
diff --git a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/ORSet.scala b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/ORSet.scala
index d3c7820a39..d618face23 100644
--- a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/ORSet.scala
+++ b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/ORSet.scala
@@ -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
diff --git a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/PruningState.scala b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/PruningState.scala
index f029624f85..36300b0d14 100644
--- a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/PruningState.scala
+++ b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/PruningState.scala
@@ -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
}
}
diff --git a/distributed-data/src/test/scala/org/apache/pekko/cluster/ddata/protobuf/ReplicatorMessageSerializerSpec.scala b/distributed-data/src/test/scala/org/apache/pekko/cluster/ddata/protobuf/ReplicatorMessageSerializerSpec.scala
index bdc84a55e1..a54adb163d 100644
--- a/distributed-data/src/test/scala/org/apache/pekko/cluster/ddata/protobuf/ReplicatorMessageSerializerSpec.scala
+++ b/distributed-data/src/test/scala/org/apache/pekko/cluster/ddata/protobuf/ReplicatorMessageSerializerSpec.scala
@@ -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
diff --git a/osgi/src/main/scala/org/apache/pekko/osgi/ActorSystemActivator.scala b/osgi/src/main/scala/org/apache/pekko/osgi/ActorSystemActivator.scala
index fbcbe7fd36..9ce75fb961 100644
--- a/osgi/src/main/scala/org/apache/pekko/osgi/ActorSystemActivator.scala
+++ b/osgi/src/main/scala/org/apache/pekko/osgi/ActorSystemActivator.scala
@@ -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
}
diff --git a/osgi/src/main/scala/org/apache/pekko/osgi/OsgiActorSystemFactory.scala b/osgi/src/main/scala/org/apache/pekko/osgi/OsgiActorSystemFactory.scala
index ec2ac267f1..475be03f12 100644
--- a/osgi/src/main/scala/org/apache/pekko/osgi/OsgiActorSystemFactory.scala
+++ b/osgi/src/main/scala/org/apache/pekko/osgi/OsgiActorSystemFactory.scala
@@ -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)
diff --git a/persistence-query/src/main/scala/org/apache/pekko/persistence/query/PersistenceQuery.scala b/persistence-query/src/main/scala/org/apache/pekko/persistence/query/PersistenceQuery.scala
index 89ea9cca07..480b6af00f 100644
--- a/persistence-query/src/main/scala/org/apache/pekko/persistence/query/PersistenceQuery.scala
+++ b/persistence-query/src/main/scala/org/apache/pekko/persistence/query/PersistenceQuery.scala
@@ -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]
diff --git a/persistence-query/src/test/scala/org/apache/pekko/persistence/query/DummyReadJournal.scala b/persistence-query/src/test/scala/org/apache/pekko/persistence/query/DummyReadJournal.scala
index 778c85cef0..905920cedb 100644
--- a/persistence-query/src/test/scala/org/apache/pekko/persistence/query/DummyReadJournal.scala
+++ b/persistence-query/src/test/scala/org/apache/pekko/persistence/query/DummyReadJournal.scala
@@ -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")
diff --git a/persistence-tck/src/main/scala/org/apache/pekko/persistence/journal/JournalSpec.scala b/persistence-tck/src/main/scala/org/apache/pekko/persistence/journal/JournalSpec.scala
index 9505e31f70..5388c35351 100644
--- a/persistence-tck/src/main/scala/org/apache/pekko/persistence/journal/JournalSpec.scala
+++ b/persistence-tck/src/main/scala/org/apache/pekko/persistence/journal/JournalSpec.scala
@@ -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
diff --git a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/PersistenceTestKitPlugin.scala b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/PersistenceTestKitPlugin.scala
index 5729ac262f..e308cb34b2 100644
--- a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/PersistenceTestKitPlugin.scala
+++ b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/PersistenceTestKitPlugin.scala
@@ -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 {
diff --git a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/query/scaladsl/PersistenceTestKitReadJournal.scala b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/query/scaladsl/PersistenceTestKitReadJournal.scala
index 9060d13427..73c7945160 100644
--- a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/query/scaladsl/PersistenceTestKitReadJournal.scala
+++ b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/query/scaladsl/PersistenceTestKitReadJournal.scala
@@ -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
diff --git a/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorRetentionSpec.scala b/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorRetentionSpec.scala
index 29a29b6369..8016af6328 100644
--- a/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorRetentionSpec.scala
+++ b/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorRetentionSpec.scala
@@ -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,
diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/EventSourcedBehaviorImpl.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/EventSourcedBehaviorImpl.scala
index 82bd7c535e..b9f406b5e4 100644
--- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/EventSourcedBehaviorImpl.scala
+++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/EventSourcedBehaviorImpl.scala
@@ -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] =
diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/ExternalInteractions.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/ExternalInteractions.scala
index 5cfde884f3..417af3ddad 100644
--- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/ExternalInteractions.scala
+++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/ExternalInteractions.scala
@@ -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)
diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/ReplayingEvents.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/ReplayingEvents.scala
index 955e2575a3..9dce502153 100644
--- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/ReplayingEvents.scala
+++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/ReplayingEvents.scala
@@ -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] = {
diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/ReplayingSnapshot.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/ReplayingSnapshot.scala
index 866a7e49bf..4d3edb442b 100644
--- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/ReplayingSnapshot.scala
+++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/ReplayingSnapshot.scala
@@ -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) {
diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/RequestingRecoveryPermit.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/RequestingRecoveryPermit.scala
index d3bf7a6076..c0ac940b73 100644
--- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/RequestingRecoveryPermit.scala
+++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/RequestingRecoveryPermit.scala
@@ -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)
diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/Running.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/Running.scala
index 2aff1b37ad..ae6c8c80e4 100644
--- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/Running.scala
+++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/Running.scala
@@ -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 = ()
}
diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/javadsl/EventSourcedBehavior.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/javadsl/EventSourcedBehavior.scala
index 6d8d88c344..a003ae5596 100644
--- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/javadsl/EventSourcedBehavior.scala
+++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/javadsl/EventSourcedBehavior.scala
@@ -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
diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/DurableStateBehaviorImpl.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/DurableStateBehaviorImpl.scala
index 89497c45db..5e7a95db5c 100644
--- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/DurableStateBehaviorImpl.scala
+++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/DurableStateBehaviorImpl.scala
@@ -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)
diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/DurableStateStoreInteractions.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/DurableStateStoreInteractions.scala
index 0063e88fc2..56e8fe8627 100644
--- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/DurableStateStoreInteractions.scala
+++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/DurableStateStoreInteractions.scala
@@ -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)
diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/Recovering.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/Recovering.scala
index 1431a0c1da..016282d796 100644
--- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/Recovering.scala
+++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/Recovering.scala
@@ -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}")
diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/RequestingRecoveryPermit.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/RequestingRecoveryPermit.scala
index 1b24c908f2..9ae4282900 100644
--- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/RequestingRecoveryPermit.scala
+++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/RequestingRecoveryPermit.scala
@@ -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")
diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/Running.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/Running.scala
index 549946e851..91d39fdad4 100644
--- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/Running.scala
+++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/Running.scala
@@ -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 = ()
}
diff --git a/persistence/src/main/scala/org/apache/pekko/persistence/fsm/PersistentFSMBase.scala b/persistence/src/main/scala/org/apache/pekko/persistence/fsm/PersistentFSMBase.scala
index c83f0c930c..0b4f894437 100644
--- a/persistence/src/main/scala/org/apache/pekko/persistence/fsm/PersistentFSMBase.scala
+++ b/persistence/src/main/scala/org/apache/pekko/persistence/fsm/PersistentFSMBase.scala
@@ -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)
diff --git a/persistence/src/main/scala/org/apache/pekko/persistence/journal/leveldb/LeveldbIdMapping.scala b/persistence/src/main/scala/org/apache/pekko/persistence/journal/leveldb/LeveldbIdMapping.scala
index 99178a2982..30339af560 100644
--- a/persistence/src/main/scala/org/apache/pekko/persistence/journal/leveldb/LeveldbIdMapping.scala
+++ b/persistence/src/main/scala/org/apache/pekko/persistence/journal/leveldb/LeveldbIdMapping.scala
@@ -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()
diff --git a/persistence/src/main/scala/org/apache/pekko/persistence/state/DurableStateStoreRegistry.scala b/persistence/src/main/scala/org/apache/pekko/persistence/state/DurableStateStoreRegistry.scala
index 874a6ec7cc..c8d88f4d7c 100644
--- a/persistence/src/main/scala/org/apache/pekko/persistence/state/DurableStateStoreRegistry.scala
+++ b/persistence/src/main/scala/org/apache/pekko/persistence/state/DurableStateStoreRegistry.scala
@@ -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]
}
diff --git a/persistence/src/test/scala/org/apache/pekko/persistence/EndToEndEventAdapterSpec.scala b/persistence/src/test/scala/org/apache/pekko/persistence/EndToEndEventAdapterSpec.scala
index f1fc8bb47f..9620edc3ad 100644
--- a/persistence/src/test/scala/org/apache/pekko/persistence/EndToEndEventAdapterSpec.scala
+++ b/persistence/src/test/scala/org/apache/pekko/persistence/EndToEndEventAdapterSpec.scala
@@ -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 {
diff --git a/persistence/src/test/scala/org/apache/pekko/persistence/LoadPluginSpec.scala b/persistence/src/test/scala/org/apache/pekko/persistence/LoadPluginSpec.scala
index 91a351cf9b..f77047c975 100644
--- a/persistence/src/test/scala/org/apache/pekko/persistence/LoadPluginSpec.scala
+++ b/persistence/src/test/scala/org/apache/pekko/persistence/LoadPluginSpec.scala
@@ -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))
}
}
diff --git a/persistence/src/test/scala/org/apache/pekko/persistence/PersistentActorStashingSpec.scala b/persistence/src/test/scala/org/apache/pekko/persistence/PersistentActorStashingSpec.scala
index c9b3936f27..bdb5c5544c 100644
--- a/persistence/src/test/scala/org/apache/pekko/persistence/PersistentActorStashingSpec.scala
+++ b/persistence/src/test/scala/org/apache/pekko/persistence/PersistentActorStashingSpec.scala
@@ -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()
}
diff --git a/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/NewRemoteActorSpec.scala b/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/NewRemoteActorSpec.scala
index ae840a77f6..c2fc7209ed 100644
--- a/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/NewRemoteActorSpec.scala
+++ b/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/NewRemoteActorSpec.scala
@@ -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
}
diff --git a/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/TransportFailSpec.scala b/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/TransportFailSpec.scala
index b4b4af8002..4a751ac355 100644
--- a/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/TransportFailSpec.scala
+++ b/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/TransportFailSpec.scala
@@ -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 = {
diff --git a/remote/src/main/scala/org/apache/pekko/remote/MessageSerializer.scala b/remote/src/main/scala/org/apache/pekko/remote/MessageSerializer.scala
index 171a2d4116..6fada47d76 100644
--- a/remote/src/main/scala/org/apache/pekko/remote/MessageSerializer.scala
+++ b/remote/src/main/scala/org/apache/pekko/remote/MessageSerializer.scala
@@ -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,
diff --git a/remote/src/main/scala/org/apache/pekko/remote/RemoteActorRefProvider.scala b/remote/src/main/scala/org/apache/pekko/remote/RemoteActorRefProvider.scala
index 9d1245be07..ddd647925b 100644
--- a/remote/src/main/scala/org/apache/pekko/remote/RemoteActorRefProvider.scala
+++ b/remote/src/main/scala/org/apache/pekko/remote/RemoteActorRefProvider.scala
@@ -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,
diff --git a/remote/src/main/scala/org/apache/pekko/remote/RemoteTransport.scala b/remote/src/main/scala/org/apache/pekko/remote/RemoteTransport.scala
index 93da52c9da..2977c33466 100644
--- a/remote/src/main/scala/org/apache/pekko/remote/RemoteTransport.scala
+++ b/remote/src/main/scala/org/apache/pekko/remote/RemoteTransport.scala
@@ -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
diff --git a/remote/src/main/scala/org/apache/pekko/remote/RemoteWatcher.scala b/remote/src/main/scala/org/apache/pekko/remote/RemoteWatcher.scala
index ac2088c92b..84bcadcf42 100644
--- a/remote/src/main/scala/org/apache/pekko/remote/RemoteWatcher.scala
+++ b/remote/src/main/scala/org/apache/pekko/remote/RemoteWatcher.scala
@@ -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
diff --git a/remote/src/main/scala/org/apache/pekko/remote/artery/Codecs.scala b/remote/src/main/scala/org/apache/pekko/remote/artery/Codecs.scala
index e790ad5995..3f9eb5957d 100644
--- a/remote/src/main/scala/org/apache/pekko/remote/artery/Codecs.scala
+++ b/remote/src/main/scala/org/apache/pekko/remote/artery/Codecs.scala
@@ -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]] {
diff --git a/remote/src/main/scala/org/apache/pekko/remote/artery/Handshake.scala b/remote/src/main/scala/org/apache/pekko/remote/artery/Handshake.scala
index b5c953f66e..c169056805 100644
--- a/remote/src/main/scala/org/apache/pekko/remote/artery/Handshake.scala
+++ b/remote/src/main/scala/org/apache/pekko/remote/artery/Handshake.scala
@@ -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,
diff --git a/remote/src/main/scala/org/apache/pekko/remote/artery/RemoteInstrument.scala b/remote/src/main/scala/org/apache/pekko/remote/artery/RemoteInstrument.scala
index 771c2fbc1d..089a5622b3 100644
--- a/remote/src/main/scala/org/apache/pekko/remote/artery/RemoteInstrument.scala
+++ b/remote/src/main/scala/org/apache/pekko/remote/artery/RemoteInstrument.scala
@@ -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._
diff --git a/remote/src/main/scala/org/apache/pekko/remote/artery/compress/InboundCompressions.scala b/remote/src/main/scala/org/apache/pekko/remote/artery/compress/InboundCompressions.scala
index 710dc8debc..4238af2490 100644
--- a/remote/src/main/scala/org/apache/pekko/remote/artery/compress/InboundCompressions.scala
+++ b/remote/src/main/scala/org/apache/pekko/remote/artery/compress/InboundCompressions.scala
@@ -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
diff --git a/remote/src/main/scala/org/apache/pekko/remote/serialization/ActorRefResolveCache.scala b/remote/src/main/scala/org/apache/pekko/remote/serialization/ActorRefResolveCache.scala
index bb901cebe4..18dbc3c429 100644
--- a/remote/src/main/scala/org/apache/pekko/remote/serialization/ActorRefResolveCache.scala
+++ b/remote/src/main/scala/org/apache/pekko/remote/serialization/ActorRefResolveCache.scala
@@ -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
}
diff --git a/remote/src/main/scala/org/apache/pekko/remote/transport/Transport.scala b/remote/src/main/scala/org/apache/pekko/remote/transport/Transport.scala
index 83f4570f6c..6244ed66d4 100644
--- a/remote/src/main/scala/org/apache/pekko/remote/transport/Transport.scala
+++ b/remote/src/main/scala/org/apache/pekko/remote/transport/Transport.scala
@@ -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) }
}
diff --git a/remote/src/main/scala/org/apache/pekko/remote/transport/netty/NettyHelpers.scala b/remote/src/main/scala/org/apache/pekko/remote/transport/netty/NettyHelpers.scala
index f1bcbe6697..4e2bbcc710 100644
--- a/remote/src/main/scala/org/apache/pekko/remote/transport/netty/NettyHelpers.scala
+++ b/remote/src/main/scala/org/apache/pekko/remote/transport/netty/NettyHelpers.scala
@@ -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")
diff --git a/remote/src/test/scala/org/apache/pekko/remote/TransientSerializationErrorSpec.scala b/remote/src/test/scala/org/apache/pekko/remote/TransientSerializationErrorSpec.scala
index 7f9ef20085..9f0b37ca6a 100644
--- a/remote/src/test/scala/org/apache/pekko/remote/TransientSerializationErrorSpec.scala
+++ b/remote/src/test/scala/org/apache/pekko/remote/TransientSerializationErrorSpec.scala
@@ -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()
diff --git a/remote/src/test/scala/org/apache/pekko/remote/artery/RemoteInstrumentsSerializationSpec.scala b/remote/src/test/scala/org/apache/pekko/remote/artery/RemoteInstrumentsSerializationSpec.scala
index e03e31cc95..14f14db866 100644
--- a/remote/src/test/scala/org/apache/pekko/remote/artery/RemoteInstrumentsSerializationSpec.scala
+++ b/remote/src/test/scala/org/apache/pekko/remote/artery/RemoteInstrumentsSerializationSpec.scala
@@ -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
diff --git a/remote/src/test/scala/org/apache/pekko/remote/serialization/DaemonMsgCreateSerializerAllowJavaSerializationSpec.scala b/remote/src/test/scala/org/apache/pekko/remote/serialization/DaemonMsgCreateSerializerAllowJavaSerializationSpec.scala
index 7bdbaa574b..f243b00e38 100644
--- a/remote/src/test/scala/org/apache/pekko/remote/serialization/DaemonMsgCreateSerializerAllowJavaSerializationSpec.scala
+++ b/remote/src/test/scala/org/apache/pekko/remote/serialization/DaemonMsgCreateSerializerAllowJavaSerializationSpec.scala
@@ -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
}
diff --git a/remote/src/test/scala/org/apache/pekko/remote/serialization/ProtobufSerializerSpec.scala b/remote/src/test/scala/org/apache/pekko/remote/serialization/ProtobufSerializerSpec.scala
index 27151d4909..d9d83c3694 100644
--- a/remote/src/test/scala/org/apache/pekko/remote/serialization/ProtobufSerializerSpec.scala
+++ b/remote/src/test/scala/org/apache/pekko/remote/serialization/ProtobufSerializerSpec.scala
@@ -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
}
diff --git a/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/JacksonMigration.scala b/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/JacksonMigration.scala
index ffad310fdb..fa343ec87a 100644
--- a/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/JacksonMigration.scala
+++ b/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/JacksonMigration.scala
@@ -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
/**
diff --git a/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/JacksonObjectMapperProvider.scala b/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/JacksonObjectMapperProvider.scala
index c458503c5e..7e46452eb6 100644
--- a/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/JacksonObjectMapperProvider.scala
+++ b/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/JacksonObjectMapperProvider.scala
@@ -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
diff --git a/slf4j/src/main/scala/org/apache/pekko/event/slf4j/Slf4jLogger.scala b/slf4j/src/main/scala/org/apache/pekko/event/slf4j/Slf4jLogger.scala
index 3e2591e787..f6d6fdf4fb 100644
--- a/slf4j/src/main/scala/org/apache/pekko/event/slf4j/Slf4jLogger.scala
+++ b/slf4j/src/main/scala/org/apache/pekko/event/slf4j/Slf4jLogger.scala
@@ -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
diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowGroupedWeightedSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowGroupedWeightedSpec.scala
index b28434610a..62630fa2a4 100644
--- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowGroupedWeightedSpec.scala
+++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowGroupedWeightedSpec.scala
@@ -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)
diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowLimitWeightedSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowLimitWeightedSpec.scala
index afbce26637..4726c1a523 100644
--- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowLimitWeightedSpec.scala
+++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowLimitWeightedSpec.scala
@@ -13,12 +13,12 @@
package org.apache.pekko.stream.scaladsl
+import scala.annotation.nowarn
import scala.concurrent.Await
import org.apache.pekko
import pekko.stream.StreamLimitReachedException
import pekko.stream.testkit.StreamSpec
-import pekko.util.unused
class FlowLimitWeightedSpec extends StreamSpec("""
pekko.stream.materializer.initial-input-buffer-size = 2
@@ -28,7 +28,7 @@ class FlowLimitWeightedSpec extends StreamSpec("""
"produce empty sequence regardless of cost when source is empty and n = 0" in {
val input = Range(0, 0, 1)
val n = input.length
- 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).limitWeighted(n)(costFn).grouped(Integer.MAX_VALUE).runWith(Sink.headOption)
val result = Await.result(future, remainingOrDefault)
result should be(None)
@@ -36,7 +36,7 @@ class FlowLimitWeightedSpec extends StreamSpec("""
"always exhaust a source regardless of n (as long as n > 0) 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 n = 1 // must not matter since costFn always evaluates to 0
val future = Source(input).limitWeighted(n)(costFn).grouped(Integer.MAX_VALUE).runWith(Sink.head)
val result = Await.result(future, remainingOrDefault)
@@ -45,7 +45,7 @@ class FlowLimitWeightedSpec extends StreamSpec("""
"exhaust source if n equals to input length and cost is 1" in {
val input = 1 to 16
- def costFn(@unused e: Int): Long = 1L
+ def costFn(@nowarn("msg=never used") e: Int): Long = 1L
val n = input.length
val future = Source(input).limitWeighted(n)(costFn).grouped(Integer.MAX_VALUE).runWith(Sink.head)
val result = Await.result(future, remainingOrDefault)
diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FramingSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FramingSpec.scala
index 043fc32f2e..ef67db1023 100644
--- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FramingSpec.scala
+++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FramingSpec.scala
@@ -16,6 +16,7 @@ package org.apache.pekko.stream.scaladsl
import java.nio.ByteOrder
import java.util.concurrent.ThreadLocalRandom
+import scala.annotation.nowarn
import scala.collection.immutable
import scala.concurrent.Future
import scala.concurrent.duration._
@@ -31,7 +32,6 @@ import pekko.stream.testkit.TestPublisher
import pekko.stream.testkit.TestSubscriber
import pekko.util.ByteString
import pekko.util.ByteStringBuilder
-import pekko.util.unused
class FramingSpec extends StreamSpec {
@@ -394,7 +394,7 @@ class FramingSpec extends StreamSpec {
"ignore length field value when provided computeFrameSize (#27884)" in {
implicit val bo = java.nio.ByteOrder.LITTLE_ENDIAN
- def computeFrameSize(@unused arr: Array[Byte], @unused l: Int): Int = 8
+ def computeFrameSize(@nowarn("msg=never used") arr: Array[Byte], @nowarn("msg=never used") l: Int): Int = 8
val bs = ByteString.newBuilder.putInt(0xFF010203).putInt(0x04050607).result()
@@ -410,7 +410,7 @@ class FramingSpec extends StreamSpec {
"fail the stage on computeFrameSize values less than minimum chunk size" in {
implicit val bo = java.nio.ByteOrder.LITTLE_ENDIAN
- def computeFrameSize(@unused arr: Array[Byte], @unused l: Int): Int = 3
+ def computeFrameSize(@nowarn("msg=never used") arr: Array[Byte], @nowarn("msg=never used") l: Int): Int = 3
// A 4-byte message containing only an Int specifying the length of the payload
val bs = ByteString.newBuilder.putInt(4).result()
diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphUnzipWithSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphUnzipWithSpec.scala
index d69708333b..453211543a 100644
--- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphUnzipWithSpec.scala
+++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphUnzipWithSpec.scala
@@ -13,6 +13,7 @@
package org.apache.pekko.stream.scaladsl
+import scala.annotation.nowarn
import scala.concurrent.Future
import scala.concurrent.duration._
import scala.util.control.NoStackTrace
@@ -26,7 +27,6 @@ import pekko.stream.testkit.TestSubscriber.Probe
import pekko.stream.testkit.Utils.TE
import pekko.testkit.EventFilter
import pekko.testkit.TestProbe
-import pekko.util.unused
import org.reactivestreams.Publisher
@@ -41,7 +41,7 @@ class GraphUnzipWithSpec extends StreamSpec("""
type LeftOutput = Int
type RightOutput = String
- abstract class Fixture(@unused b: GraphDSL.Builder[_]) {
+ abstract class Fixture(@nowarn("msg=never used") b: GraphDSL.Builder[_]) {
def in: Inlet[Int]
def left: Outlet[LeftOutput]
def right: Outlet[RightOutput]
diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/ActorProcessor.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/ActorProcessor.scala
index 486db489ed..101ce73b83 100644
--- a/stream/src/main/scala/org/apache/pekko/stream/impl/ActorProcessor.scala
+++ b/stream/src/main/scala/org/apache/pekko/stream/impl/ActorProcessor.scala
@@ -13,6 +13,8 @@
package org.apache.pekko.stream.impl
+import scala.annotation.nowarn
+
import org.apache.pekko
import pekko.actor._
import pekko.annotation.InternalApi
@@ -20,7 +22,6 @@ import pekko.event.Logging
import pekko.stream.{ AbruptTerminationException, Attributes }
import pekko.stream.ActorAttributes
import pekko.stream.impl.ActorSubscriberMessage.{ OnComplete, OnError, OnNext, OnSubscribe }
-import pekko.util.unused
import org.reactivestreams.{ Processor, Subscriber, Subscription }
@@ -165,7 +166,7 @@ import org.reactivestreams.{ Processor, Subscriber, Subscription }
case OnSubscribe(_) => throw new IllegalStateException("onSubscribe called after onError or onComplete")
}
- protected def inputOnError(@unused e: Throwable): Unit = {
+ protected def inputOnError(@nowarn("msg=never used") e: Throwable): Unit = {
clear()
}
diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/FanIn.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/FanIn.scala
index d7b5d4fa42..acea3bac9a 100644
--- a/stream/src/main/scala/org/apache/pekko/stream/impl/FanIn.scala
+++ b/stream/src/main/scala/org/apache/pekko/stream/impl/FanIn.scala
@@ -13,13 +13,14 @@
package org.apache.pekko.stream.impl
+import scala.annotation.nowarn
+
import org.apache.pekko
import pekko.actor._
import pekko.annotation.{ DoNotInherit, InternalApi }
import pekko.stream.AbruptTerminationException
import pekko.stream.ActorAttributes
import pekko.stream.Attributes
-import pekko.util.unused
import org.reactivestreams.{ Subscriber, Subscription }
@@ -133,7 +134,7 @@ import org.reactivestreams.{ Subscriber, Subscription }
def onError(input: Int, e: Throwable): Unit
- def onDepleted(@unused input: Int): Unit = ()
+ def onDepleted(@nowarn("msg=never used") input: Int): Unit = ()
def onCompleteWhenNoInput(): Unit = ()
diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/FanOut.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/FanOut.scala
index 90a175a07e..f3265f76ad 100644
--- a/stream/src/main/scala/org/apache/pekko/stream/impl/FanOut.scala
+++ b/stream/src/main/scala/org/apache/pekko/stream/impl/FanOut.scala
@@ -13,6 +13,7 @@
package org.apache.pekko.stream.impl
+import scala.annotation.nowarn
import scala.collection.immutable
import org.apache.pekko
@@ -21,7 +22,6 @@ import pekko.annotation.{ DoNotInherit, InternalApi }
import pekko.stream.AbruptTerminationException
import pekko.stream.ActorAttributes
import pekko.stream.Attributes
-import pekko.util.unused
import org.reactivestreams.Subscription
@@ -202,7 +202,7 @@ import org.reactivestreams.Subscription
enqueue(id, elem)
}
- def onCancel(@unused output: Int): Unit = ()
+ def onCancel(@nowarn("msg=never used") output: Int): Unit = ()
def demandAvailableFor(id: Int) = new TransferState {
override def isCompleted: Boolean = cancelled(id) || completed(id) || errored(id)
diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/TraversalBuilder.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/TraversalBuilder.scala
index a568d2be84..c6206a106a 100644
--- a/stream/src/main/scala/org/apache/pekko/stream/impl/TraversalBuilder.scala
+++ b/stream/src/main/scala/org/apache/pekko/stream/impl/TraversalBuilder.scala
@@ -13,6 +13,7 @@
package org.apache.pekko.stream.impl
+import scala.annotation.nowarn
import scala.collection.immutable.Map.Map1
import scala.language.existentials
@@ -25,7 +26,6 @@ import pekko.stream.impl.fusing.{ GraphStageModule, IterableSource }
import pekko.stream.impl.fusing.GraphStages.{ FutureSource, SingleSource }
import pekko.stream.scaladsl.Keep
import pekko.util.OptionVal
-import pekko.util.unused
/**
* INTERNAL API
@@ -56,7 +56,7 @@ import pekko.util.unused
Concat.normalizeConcat(this, that)
}
- def rewireFirstTo(@unused relativeOffset: Int): Traversal = null
+ def rewireFirstTo(@nowarn("msg=never used") relativeOffset: Int): Traversal = null
}
/**
diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/Ops.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/Ops.scala
index f758d2a76a..9d95de150c 100644
--- a/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/Ops.scala
+++ b/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/Ops.scala
@@ -53,7 +53,7 @@ import pekko.stream.scaladsl.{
StatefulMapConcatAccumulatorFactory
}
import pekko.stream.stage._
-import pekko.util.{ unused, ConstantFun, OptionVal }
+import pekko.util.{ ConstantFun, OptionVal }
/**
* INTERNAL API
@@ -678,7 +678,7 @@ private[stream] object Collect {
private var aggregator: Out = zero
private var aggregating: Future[Out] = Future.successful(aggregator)
- private def onRestart(@unused t: Throwable): Unit = {
+ private def onRestart(@nowarn("msg=never used") t: Throwable): Unit = {
aggregator = zero
}
diff --git a/stream/src/main/scala/org/apache/pekko/stream/javadsl/Flow.scala b/stream/src/main/scala/org/apache/pekko/stream/javadsl/Flow.scala
index 48d7e992f6..7dba8b7e06 100755
--- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/Flow.scala
+++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/Flow.scala
@@ -17,6 +17,7 @@ import java.util.Comparator
import java.util.Optional
import java.util.concurrent.CompletionStage
+import scala.annotation.nowarn
import scala.annotation.unchecked.uncheckedVariance
import scala.annotation.varargs
import scala.collection.immutable
@@ -39,7 +40,6 @@ import pekko.stream.{ javadsl, _ }
import pekko.stream.impl.fusing.{ StatefulMapConcat, ZipWithIndexJava }
import pekko.util.ConstantFun
import pekko.util.Timeout
-import pekko.util.unused
import org.reactivestreams.Processor
@@ -93,7 +93,7 @@ object Flow {
_.toJava).asJava
/** Create a `Flow` which can process elements of type `T`. */
- def of[T](@unused clazz: Class[T]): javadsl.Flow[T, T, NotUsed] = create[T]()
+ def of[T](@nowarn("msg=never used") clazz: Class[T]): javadsl.Flow[T, T, NotUsed] = create[T]()
/**
* A graph with the shape of a flow logically is a flow, this method makes it so also in type.
diff --git a/stream/src/main/scala/org/apache/pekko/stream/javadsl/Graph.scala b/stream/src/main/scala/org/apache/pekko/stream/javadsl/Graph.scala
index fce10e9665..c0f424ffbc 100644
--- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/Graph.scala
+++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/Graph.scala
@@ -16,6 +16,7 @@ package org.apache.pekko.stream.javadsl
import java.util
import java.util.Comparator
+import scala.annotation.nowarn
import scala.annotation.unchecked.uncheckedVariance
import scala.jdk.CollectionConverters._
@@ -25,7 +26,6 @@ import pekko.japi.{ function, Pair }
import pekko.stream._
import pekko.stream.scaladsl.GenericGraph
import pekko.util.ConstantFun
-import pekko.util.unused
/**
* Merge several streams, taking elements as they arrive from input streams
@@ -50,7 +50,8 @@ object Merge {
/**
* Create a new `Merge` operator with the specified output type.
*/
- def create[T](@unused clazz: Class[T], inputPorts: Int): Graph[UniformFanInShape[T, T], NotUsed] = create(inputPorts)
+ def create[T](@nowarn("msg=never used") clazz: Class[T], inputPorts: Int): Graph[UniformFanInShape[T, T], NotUsed] =
+ create(inputPorts)
/**
* Create a new `Merge` operator with the specified output type.
@@ -68,7 +69,7 @@ object Merge {
* finish as soon as one of its inputs completes
*/
def create[T](
- @unused clazz: Class[T],
+ @nowarn("msg=never used") clazz: Class[T],
inputPorts: Int,
eagerComplete: Boolean): Graph[UniformFanInShape[T, T], NotUsed] =
create(inputPorts, eagerComplete)
@@ -99,7 +100,7 @@ object MergePreferred {
* Create a new `MergePreferred` operator with the specified output type.
*/
def create[T](
- @unused clazz: Class[T],
+ @nowarn("msg=never used") clazz: Class[T],
secondaryPorts: Int): Graph[scaladsl.MergePreferred.MergePreferredShape[T], NotUsed] =
create(secondaryPorts)
@@ -121,7 +122,7 @@ object MergePreferred {
* finish as soon as one of its inputs completes
*/
def create[T](
- @unused clazz: Class[T],
+ @nowarn("msg=never used") clazz: Class[T],
secondaryPorts: Int,
eagerComplete: Boolean): Graph[scaladsl.MergePreferred.MergePreferredShape[T], NotUsed] =
create(secondaryPorts, eagerComplete)
@@ -156,7 +157,8 @@ object MergePrioritized {
/**
* Create a new `MergePrioritized` operator with the specified output type.
*/
- def create[T](@unused clazz: Class[T], priorities: Array[Int]): Graph[UniformFanInShape[T, T], NotUsed] =
+ def create[T](@nowarn("msg=never used") clazz: Class[T], priorities: Array[Int])
+ : Graph[UniformFanInShape[T, T], NotUsed] =
create(priorities)
/**
@@ -175,7 +177,7 @@ object MergePrioritized {
* finish as soon as one of its inputs completes
*/
def create[T](
- @unused clazz: Class[T],
+ @nowarn("msg=never used") clazz: Class[T],
priorities: Array[Int],
eagerComplete: Boolean): Graph[UniformFanInShape[T, T], NotUsed] =
create(priorities, eagerComplete)
@@ -217,7 +219,7 @@ object Broadcast {
/**
* Create a new `Broadcast` operator with the specified input type.
*/
- def create[T](@unused clazz: Class[T], outputCount: Int): Graph[UniformFanOutShape[T, T], NotUsed] =
+ def create[T](@nowarn("msg=never used") clazz: Class[T], outputCount: Int): Graph[UniformFanOutShape[T, T], NotUsed] =
create(outputCount)
}
@@ -347,7 +349,7 @@ object Partition {
* @param partitioner function deciding which output each element will be targeted
*/
def create[T](
- @unused clazz: Class[T],
+ @nowarn("msg=never used") clazz: Class[T],
outputCount: Int,
partitioner: function.Function[T, Integer]): Graph[UniformFanOutShape[T, T], NotUsed] =
new scaladsl.Partition(outputCount, partitioner.apply, eagerCancel = false)
@@ -361,7 +363,7 @@ object Partition {
* @param eagerCancel this operator cancels, when any (true) or all (false) of the downstreams cancel
*/
def create[T](
- @unused clazz: Class[T],
+ @nowarn("msg=never used") clazz: Class[T],
outputCount: Int,
partitioner: function.Function[T, Integer],
eagerCancel: Boolean): Graph[UniformFanOutShape[T, T], NotUsed] =
@@ -421,7 +423,7 @@ object Balance {
* @param clazz a type hint for this method
* @param outputCount number of output ports
*/
- def create[T](@unused clazz: Class[T], outputCount: Int): Graph[UniformFanOutShape[T, T], NotUsed] =
+ def create[T](@nowarn("msg=never used") clazz: Class[T], outputCount: Int): Graph[UniformFanOutShape[T, T], NotUsed] =
create(outputCount)
/**
@@ -432,7 +434,7 @@ object Balance {
* @param waitForAllDownstreams if `true` it will not start emitting elements to downstream outputs until all of them have requested at least one element
*/
def create[T](
- @unused clazz: Class[T],
+ @nowarn("msg=never used") clazz: Class[T],
outputCount: Int,
waitForAllDownstreams: Boolean): Graph[UniformFanOutShape[T, T], NotUsed] =
create(outputCount, waitForAllDownstreams)
@@ -446,7 +448,7 @@ object Balance {
* @param eagerCancel if true, balance cancels upstream if any of its downstreams cancel, if false, when all have cancelled.
*/
def create[T](
- @unused clazz: Class[T],
+ @nowarn("msg=never used") clazz: Class[T],
outputCount: Int,
waitForAllDownstreams: Boolean,
eagerCancel: Boolean): Graph[UniformFanOutShape[T, T], NotUsed] =
@@ -571,7 +573,8 @@ object Unzip {
/**
* Creates a new `Unzip` operator with the specified output types.
*/
- def create[A, B](@unused left: Class[A], @unused right: Class[B]): Graph[FanOutShape2[A Pair B, A, B], NotUsed] =
+ def create[A, B](@nowarn("msg=never used") left: Class[A], @nowarn("msg=never used") right: Class[B])
+ : Graph[FanOutShape2[A Pair B, A, B], NotUsed] =
create[A, B]()
}
@@ -610,7 +613,7 @@ object Concat {
/**
* Create a new anonymous `Concat` operator with the specified input types.
*/
- def create[T](@unused clazz: Class[T]): Graph[UniformFanInShape[T, T], NotUsed] = create()
+ def create[T](@nowarn("msg=never used") clazz: Class[T]): Graph[UniformFanInShape[T, T], NotUsed] = create()
}
@@ -671,7 +674,7 @@ object MergeSequence {
* @param extractSequence The function to extract the sequence from an element.
*/
def create[T](
- @unused clazz: Class[T],
+ @nowarn("msg=never used") clazz: Class[T],
inputCount: Int,
extractSequence: function.Function[T, Long]): Graph[UniformFanInShape[T, T], NotUsed] =
create(inputCount, extractSequence)
diff --git a/stream/src/main/scala/org/apache/pekko/stream/javadsl/Hub.scala b/stream/src/main/scala/org/apache/pekko/stream/javadsl/Hub.scala
index 1a45707a1d..c6595b1f27 100644
--- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/Hub.scala
+++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/Hub.scala
@@ -15,11 +15,12 @@ package org.apache.pekko.stream.javadsl
import java.util.function.ToLongBiFunction
+import scala.annotation.nowarn
+
import org.apache.pekko
import pekko.NotUsed
import pekko.annotation.DoNotInherit
import pekko.japi.function
-import pekko.util.unused
/**
* A MergeHub is a special streaming hub that is able to collect streamed elements from a dynamic set of
@@ -64,7 +65,7 @@ object MergeHub {
* @param clazz Type of elements this hub emits and consumes
* @param perProducerBufferSize Buffer space used per producer.
*/
- def of[T](@unused clazz: Class[T], perProducerBufferSize: Int): Source[T, Sink[T, NotUsed]] = {
+ def of[T](@nowarn("msg=never used") clazz: Class[T], perProducerBufferSize: Int): Source[T, Sink[T, NotUsed]] = {
pekko.stream.scaladsl.MergeHub.source[T](perProducerBufferSize).mapMaterializedValue(_.asJava[T]).asJava
}
@@ -86,7 +87,7 @@ object MergeHub {
* @param perProducerBufferSize Buffer space used per producer. Default value is 16.
*/
def withDraining[T](
- @unused clazz: Class[T],
+ @nowarn("msg=never used") clazz: Class[T],
perProducerBufferSize: Int): Source[T, pekko.japi.Pair[Sink[T, NotUsed], DrainingControl]] = {
pekko.stream.scaladsl.MergeHub
.sourceWithDraining[T](perProducerBufferSize)
@@ -162,7 +163,7 @@ object BroadcastHub {
* concurrent consumers can be in terms of element. If the buffer is full, the producer
* is backpressured. Must be a power of two and less than 4096.
*/
- def of[T](@unused clazz: Class[T], bufferSize: Int): Sink[T, Source[T, NotUsed]] = {
+ def of[T](@nowarn("msg=never used") clazz: Class[T], bufferSize: Int): Sink[T, Source[T, NotUsed]] = {
pekko.stream.scaladsl.BroadcastHub.sink[T](bufferSize).mapMaterializedValue(_.asJava).asJava
}
@@ -190,7 +191,8 @@ object BroadcastHub {
* is backpressured. Must be a power of two and less than 4096.
* @since 1.1.0
*/
- def of[T](@unused clazz: Class[T], startAfterNrOfConsumers: Int, bufferSize: Int): Sink[T, Source[T, NotUsed]] = {
+ def of[T](@nowarn("msg=never used") clazz: Class[T], startAfterNrOfConsumers: Int, bufferSize: Int)
+ : Sink[T, Source[T, NotUsed]] = {
pekko.stream.scaladsl.BroadcastHub.sink[T](startAfterNrOfConsumers, bufferSize).mapMaterializedValue(
_.asJava).asJava
}
@@ -259,7 +261,7 @@ object PartitionHub {
* is backpressured.
*/
def ofStateful[T](
- @unused clazz: Class[T],
+ @nowarn("msg=never used") clazz: Class[T],
partitioner: function.Creator[ToLongBiFunction[ConsumerInfo, T]],
startAfterNrOfConsumers: Int,
bufferSize: Int): Sink[T, Source[T, NotUsed]] = {
@@ -338,7 +340,7 @@ object PartitionHub {
* is backpressured.
*/
def of[T](
- @unused clazz: Class[T],
+ @nowarn("msg=never used") clazz: Class[T],
partitioner: function.Function2[Integer, T, Integer],
startAfterNrOfConsumers: Int,
bufferSize: Int): Sink[T, Source[T, NotUsed]] =
diff --git a/stream/src/main/scala/org/apache/pekko/stream/javadsl/Source.scala b/stream/src/main/scala/org/apache/pekko/stream/javadsl/Source.scala
index e2c047927a..93ed130117 100755
--- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/Source.scala
+++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/Source.scala
@@ -17,8 +17,8 @@ import java.util
import java.util.Optional
import java.util.concurrent.{ CompletableFuture, CompletionStage }
+import scala.annotation.{ nowarn, varargs }
import scala.annotation.unchecked.uncheckedVariance
-import scala.annotation.varargs
import scala.collection.immutable
import scala.concurrent.{ Future, Promise }
import scala.concurrent.ExecutionContext
@@ -37,7 +37,7 @@ import pekko.japi.function.Creator
import pekko.stream._
import pekko.stream.impl.{ LinearTraversalBuilder, UnfoldAsyncJava, UnfoldJava }
import pekko.stream.impl.fusing.{ ArraySource, StatefulMapConcat, ZipWithIndexJava }
-import pekko.util.{ unused, _ }
+import pekko.util._
import org.reactivestreams.{ Publisher, Subscriber }
@@ -54,7 +54,7 @@ object Source {
/**
* Create a `Source` with no elements. The result is the same as calling `Source.<O>empty()`
*/
- def empty[T](@unused clazz: Class[T]): Source[T, NotUsed] = empty[T]()
+ def empty[T](@nowarn("msg=never used") clazz: Class[T]): Source[T, NotUsed] = empty[T]()
/**
* Create a `Source` which materializes a [[java.util.concurrent.CompletableFuture]] which controls what element
diff --git a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Tcp.scala b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Tcp.scala
index 3113f60b56..9d5ff66355 100644
--- a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Tcp.scala
+++ b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Tcp.scala
@@ -43,7 +43,6 @@ import pekko.stream.impl.io.ConnectionSourceStage
import pekko.stream.impl.io.OutgoingConnectionStage
import pekko.stream.impl.io.TcpIdleTimeout
import pekko.util.ByteString
-import pekko.util.unused
object Tcp extends ExtensionId[Tcp] with ExtensionIdProvider {
@@ -403,7 +402,7 @@ final class Tcp(system: ExtendedActorSystem) extends pekko.actor.Extension {
}
}
-final class TcpIdleTimeoutException(msg: String, @unused timeout: Duration)
+final class TcpIdleTimeoutException(msg: String, @nowarn("msg=never used") timeout: Duration)
extends TimeoutException(msg: String)
with NoStackTrace // only used from a single stage
diff --git a/stream/src/main/scala/org/apache/pekko/stream/stage/GraphStage.scala b/stream/src/main/scala/org/apache/pekko/stream/stage/GraphStage.scala
index 6be4276095..7f8972ac2d 100644
--- a/stream/src/main/scala/org/apache/pekko/stream/stage/GraphStage.scala
+++ b/stream/src/main/scala/org/apache/pekko/stream/stage/GraphStage.scala
@@ -17,6 +17,7 @@ import java.util.Spliterator
import java.util.concurrent.{ CompletionStage, ConcurrentHashMap }
import java.util.concurrent.atomic.AtomicReference
+import scala.annotation.nowarn
import scala.annotation.tailrec
import scala.collection.{ immutable, mutable }
import scala.concurrent.{ Future, Promise }
@@ -35,7 +36,6 @@ import pekko.stream.impl.fusing.{ GraphInterpreter, GraphStageModule, SubSink, S
import pekko.stream.scaladsl.GenericGraphWithChangedAttributes
import pekko.stream.stage.ConcurrentAsyncCallbackState.{ NoPendingEvents, State }
import pekko.util.OptionVal
-import pekko.util.unused
/**
* Scala API: A GraphStage represents a reusable graph stream processing operator.
@@ -59,7 +59,8 @@ abstract class GraphStageWithMaterializedValue[+S <: Shape, +M] extends Graph[S,
@InternalApi
private[pekko] def createLogicAndMaterializedValue(
inheritedAttributes: Attributes,
- @unused materializer: Materializer): (GraphStageLogic, M) = createLogicAndMaterializedValue(inheritedAttributes)
+ @nowarn("msg=never used") materializer: Materializer): (GraphStageLogic, M) =
+ createLogicAndMaterializedValue(inheritedAttributes)
@throws(classOf[Exception])
def createLogicAndMaterializedValue(inheritedAttributes: Attributes): (GraphStageLogic, M)
@@ -1727,7 +1728,7 @@ abstract class TimerGraphStageLogic(_shape: Shape) extends GraphStageLogic(_shap
* @param timerKey key of the scheduled timer
*/
@throws(classOf[Exception])
- protected def onTimer(@unused timerKey: Any): Unit = ()
+ protected def onTimer(@nowarn("msg=never used") timerKey: Any): Unit = ()
// Internal hooks to avoid reliance on user calling super in postStop
protected[stream] override def afterPostStop(): Unit = {
diff --git a/testkit/src/main/scala/org/apache/pekko/testkit/ExplicitlyTriggeredScheduler.scala b/testkit/src/main/scala/org/apache/pekko/testkit/ExplicitlyTriggeredScheduler.scala
index dd2fb1a8a9..50693aae0f 100644
--- a/testkit/src/main/scala/org/apache/pekko/testkit/ExplicitlyTriggeredScheduler.scala
+++ b/testkit/src/main/scala/org/apache/pekko/testkit/ExplicitlyTriggeredScheduler.scala
@@ -17,6 +17,7 @@ import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.ThreadFactory
import java.util.concurrent.atomic.AtomicLong
+import scala.annotation.nowarn
import scala.annotation.tailrec
import scala.concurrent.ExecutionContext
import scala.concurrent.duration.{ Duration, FiniteDuration }
@@ -27,7 +28,6 @@ import org.apache.pekko
import pekko.actor.Cancellable
import pekko.actor.Scheduler
import pekko.event.LoggingAdapter
-import pekko.util.unused
import com.typesafe.config.Config
@@ -41,7 +41,8 @@ import com.typesafe.config.Config
* easier, but these tests might fail to catch race conditions that only
* happen when tasks are scheduled in parallel in 'real time'.
*/
-class ExplicitlyTriggeredScheduler(@unused config: Config, log: LoggingAdapter, @unused tf: ThreadFactory)
+class ExplicitlyTriggeredScheduler(@nowarn("msg=never used") config: Config, log: LoggingAdapter,
+ @nowarn("msg=never used") tf: ThreadFactory)
extends Scheduler {
private class Item(val interval: Option[FiniteDuration], val runnable: Runnable)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pekko.apache.org
For additional commands, e-mail: commits-help@pekko.apache.org