Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@

package org.apache.pekko.actor.testkit.typed

import scala.annotation.nowarn
import scala.concurrent.duration.FiniteDuration
import scala.jdk.DurationConverters._

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
Expand Down Expand Up @@ -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
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {

Expand Down Expand Up @@ -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)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@

package org.apache.pekko.actor

import scala.annotation.nowarn
import scala.concurrent.duration.{ Duration, FiniteDuration }

import org.apache.pekko
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
Expand Down Expand Up @@ -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])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

package org.apache.pekko.actor

import scala.annotation.nowarn
import scala.concurrent.duration._

import org.apache.pekko
Expand All @@ -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

Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,22 @@

package org.apache.pekko.actor

import scala.annotation.nowarn

import org.apache.pekko
import pekko.testkit.PekkoSpec
import pekko.util.unused

object PropsCreationSpec {

final class A

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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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._

Expand All @@ -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

Expand Down Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Expand Down Expand Up @@ -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]()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -34,15 +34,15 @@ 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
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 BoundedStablePriorityMailbox(PriorityGenerator({
case i: Int if i <= 100 => i // Small integers have high priority
case _: Int => 101 // Don't care for other integers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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._

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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._
Expand Down Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

package org.apache.pekko.util

import scala.annotation.nowarn
import scala.collection.immutable

import org.scalatest.matchers.should.Matchers
Expand All @@ -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)
Expand Down
Loading