From 5ac5e916cb3286f58e363fd5a1b24bad478e6895 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Thu, 3 Oct 2024 00:57:42 +0100 Subject: [PATCH] unnecessary warn annotations breaking build --- .../main/scala/org/apache/pekko/actor/AbstractActor.scala | 3 --- actor/src/main/scala/org/apache/pekko/actor/ActorCell.scala | 4 +--- actor/src/main/scala/org/apache/pekko/actor/ActorRef.scala | 5 ++--- actor/src/main/scala/org/apache/pekko/actor/Deployer.scala | 1 - .../org/apache/pekko/actor/LightArrayRevolverScheduler.scala | 3 +-- actor/src/main/scala/org/apache/pekko/actor/Scheduler.scala | 5 +---- actor/src/main/scala/org/apache/pekko/actor/TypedActor.scala | 3 --- actor/src/main/scala/org/apache/pekko/io/Dns.scala | 1 - .../scala/org/apache/pekko/io/dns/internal/DnsClient.scala | 3 +-- .../scala/org/apache/pekko/routing/SmallestMailbox.scala | 5 +---- 10 files changed, 7 insertions(+), 26 deletions(-) diff --git a/actor/src/main/scala/org/apache/pekko/actor/AbstractActor.scala b/actor/src/main/scala/org/apache/pekko/actor/AbstractActor.scala index c57a959c141..7cc0a3e84c0 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/AbstractActor.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/AbstractActor.scala @@ -19,8 +19,6 @@ import scala.concurrent.ExecutionContextExecutor import scala.concurrent.duration.Duration import scala.runtime.BoxedUnit -import scala.annotation.nowarn - import org.apache.pekko import pekko.annotation.DoNotInherit import pekko.japi.pf.ReceiveBuilder @@ -282,7 +280,6 @@ abstract class AbstractActor extends Actor { // TODO In Pekko 1.1.0, we can remove deprecation and make the method final @deprecated("Override preRestart with message parameter with Optional type instead", "Akka 2.5.0") @throws(classOf[Exception]) - @nowarn("msg=deprecated") override def preRestart(reason: Throwable, message: Option[Any]): Unit = { import pekko.util.OptionConverters._ preRestart(reason, message.toJava) 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 26131a979cc..46ed0d0b94f 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/ActorCell.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/ActorCell.scala @@ -16,8 +16,7 @@ package org.apache.pekko.actor import java.io.{ NotSerializableException, ObjectOutputStream } import java.util.concurrent.ThreadLocalRandom -import scala.annotation.{ switch, tailrec } -import scala.annotation.nowarn +import scala.annotation.{ nowarn, switch, tailrec } import scala.collection.immutable import scala.concurrent.ExecutionContextExecutor import scala.concurrent.duration.Duration @@ -416,7 +415,6 @@ private[pekko] object ActorCell { * supported APIs in this place. This is not the API you were looking * for! (waves hand) */ -@nowarn("msg=deprecated") private[pekko] class ActorCell( val system: ActorSystemImpl, val self: InternalActorRef, diff --git a/actor/src/main/scala/org/apache/pekko/actor/ActorRef.scala b/actor/src/main/scala/org/apache/pekko/actor/ActorRef.scala index df2f8720d75..71b4a648f73 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/ActorRef.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/ActorRef.scala @@ -15,8 +15,8 @@ package org.apache.pekko.actor import java.util.concurrent.ConcurrentHashMap -import scala.annotation.tailrec import scala.annotation.nowarn +import scala.annotation.tailrec import scala.collection.immutable import scala.util.control.NonFatal @@ -114,7 +114,6 @@ object ActorRef { * about the exact actor incarnation you can use the ``ActorPath`` as key because * the unique id of the actor is not taken into account when comparing actor paths. */ -@nowarn("msg=deprecated") abstract class ActorRef extends java.lang.Comparable[ActorRef] with Serializable { scalaRef: InternalActorRef with ActorRefScope => @@ -261,7 +260,7 @@ private[pekko] trait RepointableRef extends ActorRefScope { * Internal trait for assembling all the functionality needed internally on * ActorRefs. NOTE THAT THIS IS NOT A STABLE EXTERNAL INTERFACE! * - * DO NOT USE THIS UNLESS INTERNALLY WITHIN AKKA! + * DO NOT USE THIS UNLESS INTERNALLY WITHIN PEKKO! */ @nowarn("msg=deprecated") @InternalApi private[pekko] abstract class InternalActorRef extends ActorRef with ScalaActorRef { this: ActorRefScope => diff --git a/actor/src/main/scala/org/apache/pekko/actor/Deployer.scala b/actor/src/main/scala/org/apache/pekko/actor/Deployer.scala index 77953cc3d94..bd2451a5888 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/Deployer.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/Deployer.scala @@ -191,7 +191,6 @@ abstract class LocalScope extends Scope * which do not set a different scope. It is also the only scope handled by * the LocalActorRefProvider. */ -@nowarn("msg=@SerialVersionUID has no effect") @SerialVersionUID(1L) case object LocalScope extends LocalScope { diff --git a/actor/src/main/scala/org/apache/pekko/actor/LightArrayRevolverScheduler.scala b/actor/src/main/scala/org/apache/pekko/actor/LightArrayRevolverScheduler.scala index c82969ba592..7047b6e8d9f 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/LightArrayRevolverScheduler.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/LightArrayRevolverScheduler.scala @@ -17,7 +17,7 @@ import java.io.Closeable import java.util.concurrent.ThreadFactory import java.util.concurrent.atomic.{ AtomicLong, AtomicReference } -import scala.annotation.{ nowarn, tailrec } +import scala.annotation.tailrec import scala.collection.immutable import scala.concurrent.{ Await, ExecutionContext, Future, Promise } import scala.concurrent.duration._ @@ -350,7 +350,6 @@ class LightArrayRevolverScheduler(config: Config, log: LoggingAdapter, threadFac } object LightArrayRevolverScheduler { - @nowarn("msg=deprecated") private[this] val taskOffset = unsafe.objectFieldOffset(classOf[TaskHolder].getDeclaredField("task")) private class TaskQueue extends AbstractNodeQueue[TaskHolder] diff --git a/actor/src/main/scala/org/apache/pekko/actor/Scheduler.scala b/actor/src/main/scala/org/apache/pekko/actor/Scheduler.scala index 5095c9ed7db..7c54adc867f 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/Scheduler.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/Scheduler.scala @@ -15,8 +15,7 @@ package org.apache.pekko.actor import java.util.concurrent.atomic.AtomicReference -import scala.annotation.nowarn -import scala.annotation.tailrec +import scala.annotation.{ nowarn, tailrec } import scala.concurrent.ExecutionContext import scala.concurrent.duration._ import scala.util.control.NoStackTrace @@ -145,7 +144,6 @@ trait Scheduler { * * Note: For scheduling within actors `with Timers` should be preferred. */ - @nowarn("msg=deprecated") final def scheduleWithFixedDelay( initialDelay: FiniteDuration, delay: FiniteDuration, @@ -342,7 +340,6 @@ trait Scheduler { "Use scheduleWithFixedDelay or scheduleAtFixedRate instead. This has the same semantics as " + "scheduleAtFixedRate, but scheduleWithFixedDelay is often preferred.", since = "Akka 2.6.0") - @nowarn("msg=deprecated") final def schedule(initialDelay: FiniteDuration, interval: FiniteDuration, receiver: ActorRef, message: Any)( implicit executor: ExecutionContext, diff --git a/actor/src/main/scala/org/apache/pekko/actor/TypedActor.scala b/actor/src/main/scala/org/apache/pekko/actor/TypedActor.scala index 9274ebc6266..989da5f8d42 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/TypedActor.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/TypedActor.scala @@ -138,7 +138,6 @@ object TypedActor extends ExtensionId[TypedActorExtension] with ExtensionIdProvi * * Java API */ - @nowarn("msg=deprecated") def get(context: ActorContext): TypedActorFactory = apply(context) /** @@ -297,7 +296,6 @@ object TypedActor extends ExtensionId[TypedActorExtension] with ExtensionIdProvi } } - @nowarn("msg=deprecated") override def postStop(): Unit = try { withContext { @@ -516,7 +514,6 @@ object TypedActor extends ExtensionId[TypedActorExtension] with ExtensionIdProvi case some => toTypedActorInvocationHandler(some) } - @nowarn("msg=deprecated") def toTypedActorInvocationHandler(system: ActorSystem): TypedActorInvocationHandler = new TypedActorInvocationHandler(pekko.actor.TypedActor(system), new AtomVar[ActorRef](actor), new Timeout(timeout)) 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 c728e525a2b..f7d61547a52 100644 --- a/actor/src/main/scala/org/apache/pekko/io/Dns.scala +++ b/actor/src/main/scala/org/apache/pekko/io/Dns.scala @@ -127,7 +127,6 @@ object Dns extends ExtensionId[DnsExt] with ExtensionIdProvider { * trigger a resolve and return None. */ @deprecated("use resolve(DnsProtocol.Resolve)", "Akka 2.6.0") - @nowarn("msg=deprecated") def resolve(name: String)(system: ActorSystem, sender: ActorRef): Option[Resolved] = { Dns(system).cache.resolve(name)(system, sender) } diff --git a/actor/src/main/scala/org/apache/pekko/io/dns/internal/DnsClient.scala b/actor/src/main/scala/org/apache/pekko/io/dns/internal/DnsClient.scala index 07566dff922..f8fd993d395 100644 --- a/actor/src/main/scala/org/apache/pekko/io/dns/internal/DnsClient.scala +++ b/actor/src/main/scala/org/apache/pekko/io/dns/internal/DnsClient.scala @@ -14,10 +14,10 @@ package org.apache.pekko.io.dns.internal import java.net.{ InetAddress, InetSocketAddress } +import scala.annotation.tailrec import scala.collection.{ immutable => im } import scala.concurrent.duration._ import scala.util.Try -import scala.annotation.{ nowarn, tailrec } import org.apache.pekko import pekko.actor.{ Actor, ActorLogging, ActorRef, NoSerializationVerificationNeeded, Props, Stash } import pekko.actor.Status.Failure @@ -90,7 +90,6 @@ import pekko.pattern.{ BackoffOpts, BackoffSupervisor } /** * Silent to allow map update syntax */ - @nowarn() def ready(socket: ActorRef): Receive = { case DropRequest(msg) => inflightRequests.get(msg.id).foreach { diff --git a/actor/src/main/scala/org/apache/pekko/routing/SmallestMailbox.scala b/actor/src/main/scala/org/apache/pekko/routing/SmallestMailbox.scala index a549d66bd5a..e7a778b81c6 100644 --- a/actor/src/main/scala/org/apache/pekko/routing/SmallestMailbox.scala +++ b/actor/src/main/scala/org/apache/pekko/routing/SmallestMailbox.scala @@ -15,10 +15,9 @@ package org.apache.pekko.routing import java.util.concurrent.ThreadLocalRandom -import scala.annotation.tailrec +import scala.annotation.{ nowarn, tailrec } import scala.collection.immutable -import scala.annotation.nowarn import com.typesafe.config.Config import org.apache.pekko @@ -93,7 +92,6 @@ class SmallestMailboxRoutingLogic extends RoutingLogic { } // TODO should we rewrite this not to use isTerminated? - @nowarn("msg=deprecated") protected def isTerminated(a: Routee): Boolean = a match { case ActorRefRoutee(ref) => ref.isTerminated case _ => false @@ -191,7 +189,6 @@ class SmallestMailboxRoutingLogic extends RoutingLogic { * @param routerDispatcher dispatcher to use for the router head actor, which handles * supervision, death watch and router management messages */ -@nowarn("msg=@SerialVersionUID has no effect") @SerialVersionUID(1L) final case class SmallestMailboxPool( nrOfInstances: Int,