From 9d8b9f88e8d7fd64eba56f70ec3e4bd2cb026146 Mon Sep 17 00:00:00 2001 From: He-Pin Date: Wed, 17 Jan 2024 02:21:15 +0800 Subject: [PATCH] chore: run scalafmtAll to do the rewrite. --- .../pekko/actor/testkit/typed/Effect.scala | 18 +- .../actor/testkit/typed/TestKitSettings.scala | 10 +- .../typed/internal/ActorSystemStub.scala | 2 +- .../typed/internal/LoggingTestKitImpl.scala | 12 +- .../typed/internal/StubbedActorContext.scala | 4 +- .../testkit/typed/internal/TestKitUtils.scala | 4 +- .../typed/internal/TestProbeImpl.scala | 2 +- .../testkit/typed/javadsl/ActorTestKit.scala | 8 +- .../typed/javadsl/JUnit5TestKitBuilder.scala | 4 +- .../typed/javadsl/LoggingTestKit.scala | 6 +- .../testkit/typed/javadsl/ManualTime.scala | 2 +- .../typed/javadsl/SerializationTestKit.scala | 2 +- .../typed/javadsl/TestKitJunitResource.scala | 2 +- .../testkit/typed/javadsl/TestProbe.scala | 8 +- .../testkit/typed/scaladsl/ActorTestKit.scala | 8 +- .../typed/scaladsl/LoggingTestKit.scala | 4 +- .../testkit/typed/scaladsl/ManualTime.scala | 4 +- .../scaladsl/ScalaTestWithActorTestKit.scala | 2 +- .../typed/scaladsl/SerializationTestKit.scala | 2 +- .../testkit/typed/scaladsl/TestProbe.scala | 4 +- .../scaladsl/SyncTestingExampleSpec.scala | 4 +- .../typed/scaladsl/ActorTestKitSpec.scala | 4 +- .../typed/scaladsl/BehaviorTestKitSpec.scala | 6 +- .../org/apache/pekko/PekkoExceptionSpec.scala | 2 +- .../apache/pekko/actor/ActorMailboxSpec.scala | 2 +- .../pekko/actor/DynamicAccessSpec.scala | 2 +- .../apache/pekko/actor/ExtensionSpec.scala | 2 +- .../pekko/actor/SupervisorHierarchySpec.scala | 4 +- .../apache/pekko/actor/TypedActorSpec.scala | 4 +- .../pekko/dispatch/MailboxConfigSpec.scala | 2 +- .../pekko/pattern/StatusReplySpec.scala | 2 +- .../SerializationSetupSpec.scala | 2 +- .../pekko/serialization/SerializeSpec.scala | 10 +- .../pekko/util/BoundedBlockingQueueSpec.scala | 2 +- .../util/ByteStringInitializationSpec.scala | 2 +- .../apache/pekko/util/ByteStringSpec.scala | 2 +- .../apache/pekko/util/WildcardIndexSpec.scala | 6 +- .../pekko/typed/InteractionPatternsSpec.scala | 4 +- .../pekko/typed/LoggingDocExamples.scala | 4 +- .../pekko/typed/StyleGuideDocExamples.scala | 2 +- .../typed/extensions/ExtensionDocSpec.scala | 6 +- .../apache/pekko/actor/typed/AskSpec.scala | 2 +- .../pekko/actor/typed/ExtensionsSpec.scala | 20 +-- ...LocalActorRefProviderLogMessagesSpec.scala | 8 +- .../actor/typed/MailboxSelectorSpec.scala | 2 +- .../pekko/actor/typed/SupervisionSpec.scala | 6 +- .../DurableProducerControllerSpec.scala | 4 +- .../delivery/DurableWorkPullingSpec.scala | 4 +- .../delivery/ReliableDeliveryRandomSpec.scala | 4 +- .../typed/internal/ActorSystemSpec.scala | 2 +- .../receptionist/LocalReceptionistSpec.scala | 2 +- .../apache/pekko/actor/typed/ActorRef.scala | 2 +- .../pekko/actor/typed/ActorRefResolver.scala | 10 +- .../actor/typed/BehaviorInterceptor.scala | 8 +- .../apache/pekko/actor/typed/Extensions.scala | 10 +- .../typed/delivery/ConsumerController.scala | 4 +- .../typed/delivery/DurableProducerQueue.scala | 4 +- .../typed/delivery/ProducerController.scala | 4 +- .../WorkPullingProducerController.scala | 4 +- .../internal/ConsumerControllerImpl.scala | 18 +- .../internal/ProducerControllerImpl.scala | 4 +- .../actor/typed/eventstream/EventStream.scala | 2 +- .../typed/internal/ActorContextImpl.scala | 14 +- .../typed/internal/ActorFlightRecorder.scala | 2 +- .../actor/typed/internal/ActorRefImpl.scala | 4 +- .../typed/internal/EventStreamExtension.scala | 4 +- .../actor/typed/internal/ExtensionsImpl.scala | 12 +- .../typed/internal/InterceptorImpl.scala | 10 +- .../actor/typed/internal/LoggerClass.scala | 6 +- .../internal/MiscMessageSerializer.scala | 4 +- .../actor/typed/internal/PoisonPill.scala | 2 +- .../actor/typed/internal/Supervision.scala | 18 +- .../internal/WithMdcBehaviorInterceptor.scala | 4 +- .../typed/internal/adapter/ActorAdapter.scala | 8 +- .../adapter/ActorContextAdapter.scala | 8 +- .../internal/adapter/ActorRefAdapter.scala | 4 +- .../internal/adapter/ActorSystemAdapter.scala | 6 +- .../receptionist/LocalReceptionist.scala | 8 +- .../receptionist/ReceptionistImpl.scala | 2 +- .../receptionist/ReceptionistMessages.scala | 6 +- .../receptionist/ServiceKeySerializer.scala | 4 +- .../internal/routing/GroupRouterImpl.scala | 2 +- .../internal/routing/PoolRouterImpl.scala | 2 +- .../actor/typed/javadsl/ActorContext.scala | 2 +- .../pekko/actor/typed/javadsl/Adapter.scala | 18 +- .../actor/typed/javadsl/BehaviorBuilder.scala | 4 +- .../actor/typed/javadsl/ReceiveBuilder.scala | 4 +- .../typed/receptionist/Receptionist.scala | 26 +-- .../actor/typed/scaladsl/ActorContext.scala | 2 +- .../actor/typed/scaladsl/AskPattern.scala | 4 +- .../typed/scaladsl/adapter/package.scala | 8 +- .../apache/pekko/actor/AbstractProps.scala | 20 +-- .../org/apache/pekko/actor/ActorCell.scala | 2 +- .../org/apache/pekko/actor/ActorSystem.scala | 8 +- .../pekko/actor/CoordinatedShutdown.scala | 2 +- .../org/apache/pekko/actor/Deployer.scala | 2 +- .../apache/pekko/actor/DynamicAccess.scala | 6 +- .../org/apache/pekko/actor/Extension.scala | 2 +- .../scala/org/apache/pekko/actor/FSM.scala | 4 +- .../apache/pekko/actor/FaultHandling.scala | 16 +- .../pekko/actor/IndirectActorProducer.scala | 16 +- .../scala/org/apache/pekko/actor/Props.scala | 12 +- .../pekko/actor/ReflectiveDynamicAccess.scala | 10 +- .../org/apache/pekko/actor/TypedActor.scala | 34 ++-- .../actor/dungeon/ChildrenContainer.scala | 4 +- .../apache/pekko/actor/dungeon/Dispatch.scala | 2 +- .../pekko/actor/setup/ActorSystemSetup.scala | 2 +- .../ForkJoinExecutorConfigurator.scala | 2 +- .../org/apache/pekko/dispatch/Mailboxes.scala | 26 +-- .../pekko/dispatch/ThreadPoolBuilder.scala | 8 +- .../org/apache/pekko/event/EventStream.scala | 14 +- .../org/apache/pekko/event/Logging.scala | 154 +++++++++--------- .../apache/pekko/event/jul/JavaLogger.scala | 10 +- .../org/apache/pekko/io/DnsProvider.scala | 4 +- .../scala/org/apache/pekko/japi/JavaAPI.scala | 4 +- .../apache/pekko/pattern/CircuitBreaker.scala | 6 +- .../pattern/CircuitBreakersRegistry.scala | 2 +- .../apache/pekko/pattern/StatusReply.scala | 4 +- .../serialization/PrimitiveSerializers.scala | 10 +- .../pekko/serialization/Serialization.scala | 24 +-- .../serialization/SerializationSetup.scala | 6 +- .../pekko/serialization/Serializer.scala | 20 +-- .../pekko/util/BoundedBlockingQueue.scala | 14 +- .../org/apache/pekko/util/BoxedType.scala | 4 +- .../util/ClassLoaderObjectInputStream.scala | 2 +- .../org/apache/pekko/util/LineNumbers.scala | 2 +- .../scala/org/apache/pekko/util/Reflect.scala | 20 +-- .../org/apache/pekko/util/TypedMultiMap.scala | 2 +- .../actor/typed/TypedBenchmarkActors.scala | 2 +- .../pekko/remote/artery/CodecBenchmark.scala | 2 +- .../pekko/stream/FlowMapBenchmark.scala | 2 +- .../org/apache/pekko/util/StackBench.scala | 4 +- .../sharding/typed/ClusterShardingQuery.scala | 8 +- .../typed/ClusterShardingSettings.scala | 4 +- .../typed/ReplicatedShardingExtension.scala | 4 +- .../typed/ShardedDaemonProcessSettings.scala | 4 +- .../delivery/ShardingConsumerController.scala | 4 +- .../delivery/ShardingProducerController.scala | 4 +- .../ShardingConsumerControllerImpl.scala | 2 +- .../typed/internal/ClusterShardingImpl.scala | 12 +- .../ReplicatedShardingExtensionImpl.scala | 2 +- .../internal/ShardedDaemonProcessImpl.scala | 2 +- .../typed/internal/ShardingSerializer.scala | 6 +- .../internal/testkit/TestEntityRefImpl.scala | 4 +- .../typed/javadsl/ClusterSharding.scala | 2 +- .../typed/javadsl/ShardedDaemonProcess.scala | 2 +- .../typed/scaladsl/ClusterSharding.scala | 6 +- .../typed/scaladsl/ShardedDaemonProcess.scala | 2 +- ...eStateStoreQueryUsageCompileOnlySpec.scala | 2 +- ...ternalShardAllocationCompileOnlySpec.scala | 2 +- .../HelloWorldPersistentEntityExample.scala | 2 +- .../ReplicatedShardingCompileOnlySpec.scala | 2 +- ...nfigCompatCheckerClusterShardingSpec.scala | 4 +- .../typed/ReplicatedShardingSpec.scala | 2 +- .../typed/delivery/DurableShardingSpec.scala | 8 +- .../ClusterShardingPersistenceSpec.scala | 2 +- .../sharding/ShardingFlightRecorder.scala | 2 +- .../MultiNodeClusterShardingConfig.scala | 2 +- .../sharding/ShardingQueriesSpec.scala | 6 +- .../typed/internal/ReplicatorBehavior.scala | 14 +- .../ddata/typed/javadsl/DistributedData.scala | 10 +- .../typed/javadsl/ReplicatorSettings.scala | 2 +- .../typed/scaladsl/DistributedData.scala | 6 +- .../typed/scaladsl/ReplicatorSettings.scala | 4 +- .../apache/pekko/cluster/typed/Cluster.scala | 8 +- .../cluster/typed/ClusterSingleton.scala | 16 +- .../typed/internal/AdaptedClusterImpl.scala | 4 +- .../AdaptedClusterSingletonImpl.scala | 10 +- .../PekkoClusterTypedSerializer.scala | 8 +- .../delivery/ReliableDeliverySerializer.scala | 26 +-- .../receptionist/ClusterReceptionist.scala | 20 +-- .../ClusterReceptionistSettings.scala | 2 +- .../internal/receptionist/Registry.scala | 12 +- .../typed/BasicClusterExampleSpec.scala | 10 +- .../typed/DistributedPubSubExample.scala | 6 +- .../pekko/cluster/typed/GroupRouterSpec.scala | 8 +- .../org/apache/pekko/cluster/Cluster.scala | 6 +- .../apache/pekko/cluster/ClusterDaemon.scala | 4 +- .../apache/pekko/cluster/ClusterEvent.scala | 4 +- .../SurviveNetworkInstabilitySpec.scala | 2 +- .../lease/scaladsl/LeaseProvider.scala | 2 +- .../org/apache/pekko/cluster/ddata/Key.scala | 4 +- .../apache/pekko/cluster/ddata/LWWMap.scala | 2 +- .../pekko/cluster/ddata/LWWRegister.scala | 2 +- .../apache/pekko/cluster/ddata/ORMap.scala | 38 ++--- .../pekko/cluster/ddata/ORMultiMap.scala | 2 +- .../apache/pekko/cluster/ddata/ORSet.scala | 28 ++-- .../pekko/cluster/ddata/PNCounterMap.scala | 2 +- .../pekko/cluster/ddata/Replicator.scala | 4 +- .../protobuf/ReplicatedDataSerializer.scala | 134 +++++++-------- .../ReplicatorMessageSerializer.scala | 56 +++---- .../ddata/JepsenInspiredInsertSpec.scala | 16 +- .../cluster/ddata/ReplicatorChaosSpec.scala | 6 +- .../cluster/ddata/ReplicatorDeltaSpec.scala | 24 +-- .../cluster/ddata/ReplicatorGossipSpec.scala | 4 +- .../ddata/ReplicatorORSetDeltaSpec.scala | 2 +- .../pekko/cluster/ddata/ReplicatorSpec.scala | 10 +- .../cluster/ddata/LocalConcurrencySpec.scala | 2 +- .../pekko/cluster/ddata/LotsOfDataBot.scala | 2 +- .../actor/SharedMutableStateDocSpec.scala | 2 +- .../docs/ddata/DistributedDataDocSpec.scala | 10 +- .../test/scala/docs/ddata/ShoppingCart.scala | 4 +- .../protobuf/TwoPhaseSetSerializer.scala | 4 +- .../protobuf/TwoPhaseSetSerializer2.scala | 2 +- .../scala/docs/event/LoggingDocSpec.scala | 2 +- docs/src/test/scala/docs/io/EchoServer.scala | 2 +- .../PersistenceSerializerDocSpec.scala | 4 +- .../serialization/SerializationDocSpec.scala | 2 +- .../scala/docs/stream/GraphDSLDocSpec.scala | 4 +- .../stream/cookbook/RecipeAdhocSource.scala | 2 +- .../docs/stream/operators/source/Zip.scala | 2 +- .../stream/operators/sourceorflow/Limit.scala | 2 +- .../sourceorflow/LimitWeighted.scala | 2 +- .../pekko/remote/testconductor/Player.scala | 4 +- .../pekko/remote/testkit/MultiNodeSpec.scala | 4 +- .../pekko/osgi/ActorSystemActivator.scala | 4 +- .../osgi/BundleDelegatingClassLoader.scala | 4 +- .../apache/pekko/osgi/PojoSRTestSupport.scala | 2 +- .../query/internal/QuerySerializer.scala | 4 +- .../leveldb/AllPersistenceIdsStage.scala | 2 +- .../leveldb/EventsByPersistenceIdStage.scala | 2 +- .../journal/leveldb/EventsByTagStage.scala | 2 +- .../query/typed/EventEnvelope.scala | 2 +- .../serialization/SerializerSpec.scala | 4 +- .../EventSourcedBehaviorTestKitImpl.scala | 6 +- .../SnapshotStorageEmulatorExtension.scala | 2 +- .../javadsl/EventSourcedBehaviorTestKit.scala | 4 +- .../testkit/javadsl/PersistenceTestKit.scala | 2 +- .../testkit/javadsl/SnapshotTestKit.scala | 2 +- .../EventSourcedBehaviorTestKit.scala | 4 +- .../testkit/scaladsl/PersistenceTestKit.scala | 2 +- .../testkit/scaladsl/TestOps.scala | 10 +- ...plicatedEventSourcingCompileOnlySpec.scala | 4 +- .../EventSourcedBehaviorReplySpec.scala | 8 +- .../scaladsl/EventSourcedBehaviorSpec.scala | 16 +- .../EventSourcedBehaviorStashSpec.scala | 12 +- .../EventSourcedBehaviorWatchSpec.scala | 4 +- .../DurableStateBehaviorReplySpec.scala | 6 +- .../pekko/persistence/typed/crdt/ORSet.scala | 2 +- .../delivery/EventSourcedProducerQueue.scala | 8 +- .../internal/EventSourcedBehaviorImpl.scala | 8 +- .../typed/internal/EventSourcedSettings.scala | 2 +- .../typed/internal/ExternalInteractions.scala | 8 +- .../typed/internal/ReplayingEvents.scala | 8 +- .../typed/internal/ReplayingSnapshot.scala | 4 +- .../internal/RequestingRecoveryPermit.scala | 2 +- .../persistence/typed/internal/Running.scala | 14 +- .../typed/javadsl/EventSourcedBehavior.scala | 4 +- .../typed/scaladsl/EventSourcedBehavior.scala | 14 +- .../ReplicatedEventSourcingSerializer.scala | 28 ++-- .../internal/DurableStateBehaviorImpl.scala | 6 +- .../state/internal/DurableStateSettings.scala | 2 +- .../DurableStateStoreInteractions.scala | 4 +- .../typed/state/internal/Recovering.scala | 6 +- .../internal/RequestingRecoveryPermit.scala | 2 +- .../typed/state/internal/Running.scala | 12 +- .../state/javadsl/DurableStateBehavior.scala | 2 +- .../state/scaladsl/DurableStateBehavior.scala | 12 +- ...leStatePersistentBehaviorCompileOnly.scala | 24 +-- .../typed/StashingWhenSnapshottingSpec.scala | 2 +- .../typed/internal/StashStateSpec.scala | 2 +- .../PersistentActorCompileOnlyTest.scala | 2 +- .../apache/pekko/persistence/TraitOrder.scala | 2 +- .../pekko/persistence/PersistencePlugin.scala | 4 +- .../persistence/journal/EventAdapters.scala | 18 +- .../journal/PersistencePluginProxy.scala | 2 +- .../serialization/MessageSerializer.scala | 2 +- .../serialization/SnapshotSerializer.scala | 2 +- .../state/DurableStateStoreRegistry.scala | 14 +- .../persistence/AtLeastOnceDeliverySpec.scala | 2 +- .../persistence/PersistentActorSpec.scala | 2 +- ...SnapshotRecoveryWithEmptyJournalSpec.scala | 2 +- .../SnapshotSerializationSpec.scala | 2 +- .../pekko/persistence/SnapshotSpec.scala | 2 +- .../SnapshotSerializerSpec.scala | 4 +- .../org/apache/pekko/remote/Endpoint.scala | 2 +- .../apache/pekko/remote/RemoteDaemon.scala | 2 +- .../pekko/remote/RemoteMetricsExtension.scala | 2 +- .../pekko/remote/artery/Handshake.scala | 2 +- .../remote/artery/ImmutableLongMap.scala | 2 +- .../remote/artery/RemoteInstrument.scala | 2 +- .../artery/RemotingFlightRecorder.scala | 2 +- .../remote/artery/SystemMessageDelivery.scala | 4 +- .../artery/compress/CompressionTable.scala | 2 +- .../remote/artery/tcp/ssl/X509Readers.scala | 2 +- .../DaemonMsgCreateSerializer.scala | 2 +- .../MessageContainerSerializer.scala | 2 +- .../serialization/MiscMessageSerializer.scala | 14 +- .../serialization/PrimitiveSerializers.scala | 8 +- .../serialization/ProtobufSerializer.scala | 16 +- .../SystemMessageSerializer.scala | 2 +- .../RemoteInstrumentsSerializationSpec.scala | 8 +- ...SerializerAllowJavaSerializationSpec.scala | 4 +- .../serialization/jackson/JacksonModule.scala | 14 +- .../jackson/JacksonSerializer.scala | 22 +-- .../jackson/StreamRefModule.scala | 24 +-- .../jackson/TypedActorRefModule.scala | 12 +- .../pekko/event/slf4j/Slf4jLogger.scala | 18 +- .../pekko/stream/testkit/StreamTestKit.scala | 8 +- .../impl/fusing/GraphInterpreterSpecKit.scala | 30 ++-- .../pekko/stream/testkit/ChainSetup.scala | 6 +- .../pekko/stream/testkit/ScriptedTest.scala | 2 +- .../pekko/stream/testkit/StreamSpec.scala | 2 +- .../stream/testkit/TwoStreamsSetup.scala | 2 +- .../FlatMapConcatDoubleSubscriberTest.scala | 2 +- .../PekkoIdentityProcessorVerification.scala | 2 +- .../pekko/stream/DslConsistencySpec.scala | 40 ++--- .../stream/DslFactoriesConsistencySpec.scala | 44 ++--- .../pekko/stream/impl/FixedBufferSpec.scala | 12 +- .../fusing/ActorGraphInterpreterSpec.scala | 4 +- .../scaladsl/CoupledTerminationFlowSpec.scala | 4 +- .../stream/scaladsl/FlowCompileSpec.scala | 32 ++-- .../stream/scaladsl/FlowConcatAllSpec.scala | 2 +- .../stream/scaladsl/FlowConcatSpec.scala | 12 +- .../stream/scaladsl/FlowGroupBySpec.scala | 14 +- .../stream/scaladsl/FlowOnCompleteSpec.scala | 2 +- .../scaladsl/FlowPrefixAndTailSpec.scala | 12 +- .../stream/scaladsl/FlowScanAsyncSpec.scala | 2 +- .../pekko/stream/scaladsl/FlowSpec.scala | 26 +-- .../stream/scaladsl/FlowSplitAfterSpec.scala | 6 +- .../stream/scaladsl/FlowSplitWhenSpec.scala | 6 +- .../pekko/stream/scaladsl/FlowTakeSpec.scala | 2 +- .../stream/scaladsl/GraphConcatSpec.scala | 2 +- .../scaladsl/GraphMergeLatestSpec.scala | 2 +- .../scaladsl/GraphMergePreferredSpec.scala | 2 +- .../scaladsl/GraphMergePrioritizedSpec.scala | 2 +- .../scaladsl/GraphMergeSequenceSpec.scala | 2 +- .../scaladsl/GraphMergeSortedSpec.scala | 2 +- .../stream/scaladsl/GraphMergeSpec.scala | 2 +- .../scaladsl/GraphOpsIntegrationSpec.scala | 6 +- .../stream/scaladsl/GraphUnzipWithSpec.scala | 6 +- .../scaladsl/GraphZipLatestWithSpec.scala | 2 +- .../pekko/stream/scaladsl/GraphZipNSpec.scala | 2 +- .../pekko/stream/scaladsl/GraphZipSpec.scala | 2 +- .../stream/scaladsl/GraphZipWithNSpec.scala | 2 +- .../stream/scaladsl/GraphZipWithSpec.scala | 2 +- .../pekko/stream/scaladsl/RestartSpec.scala | 2 +- .../SubstreamSubscriptionTimeoutSpec.scala | 6 +- .../stream/MapAsyncPartitionedSpec.scala | 2 +- .../stream/typed/ActorSourceSinkExample.scala | 8 +- .../pekko/util/PekkoLoggerBridge.scala | 6 +- .../org/apache/pekko/stream/FanInShape.scala | 12 +- .../org/apache/pekko/stream/FanOutShape.scala | 12 +- .../scala/org/apache/pekko/stream/Shape.scala | 50 +++--- .../pekko/stream/impl/ActorPublisher.scala | 12 +- .../impl/ActorRefBackpressureSource.scala | 2 +- .../pekko/stream/impl/ActorRefSinkStage.scala | 2 +- .../pekko/stream/impl/ActorRefSource.scala | 2 +- .../stream/impl/CompletedPublishers.scala | 6 +- .../org/apache/pekko/stream/impl/FanOut.scala | 2 +- .../pekko/stream/impl/FanoutProcessor.scala | 4 +- .../impl/PhasedFusingActorMaterializer.scala | 2 +- .../pekko/stream/impl/QueueSource.scala | 2 +- .../org/apache/pekko/stream/impl/Sinks.scala | 4 +- .../pekko/stream/impl/StreamLayout.scala | 32 ++-- .../impl/StreamSubscriptionTimeout.scala | 12 +- .../stream/impl/SubscriberManagement.scala | 8 +- .../pekko/stream/impl/TraversalBuilder.scala | 10 +- .../impl/fusing/ActorGraphInterpreter.scala | 2 +- .../stream/impl/fusing/GraphStages.scala | 4 +- .../apache/pekko/stream/impl/fusing/Ops.scala | 8 +- .../stream/impl/fusing/StreamOfStreams.scala | 8 +- .../stream/impl/io/InputStreamSource.scala | 2 +- .../impl/io/OutputStreamGraphStage.scala | 2 +- .../stream/impl/streamref/SinkRefImpl.scala | 2 +- .../stream/impl/streamref/SourceRefImpl.scala | 2 +- .../apache/pekko/stream/javadsl/Flow.scala | 68 ++++---- .../stream/javadsl/FlowWithContext.scala | 2 +- .../apache/pekko/stream/javadsl/Graph.scala | 30 ++-- .../pekko/stream/javadsl/RestartFlow.scala | 16 +- .../pekko/stream/javadsl/RestartSink.scala | 10 +- .../pekko/stream/javadsl/RestartSource.scala | 20 +-- .../apache/pekko/stream/javadsl/Sink.scala | 10 +- .../apache/pekko/stream/javadsl/Source.scala | 80 ++++----- .../stream/javadsl/SourceWithContext.scala | 2 +- .../stream/javadsl/StreamConverters.scala | 4 +- .../apache/pekko/stream/javadsl/SubFlow.scala | 42 ++--- .../pekko/stream/javadsl/SubSource.scala | 42 ++--- .../apache/pekko/stream/javadsl/package.scala | 2 +- .../apache/pekko/stream/scaladsl/Flow.scala | 42 ++--- .../apache/pekko/stream/scaladsl/Graph.scala | 102 ++++++------ .../pekko/stream/scaladsl/RestartFlow.scala | 16 +- .../pekko/stream/scaladsl/RestartSink.scala | 8 +- .../pekko/stream/scaladsl/RestartSource.scala | 14 +- .../apache/pekko/stream/scaladsl/Sink.scala | 6 +- .../apache/pekko/stream/scaladsl/Source.scala | 14 +- .../stream/scaladsl/StreamConverters.scala | 4 +- .../apache/pekko/stream/scaladsl/Tcp.scala | 8 +- .../serialization/StreamRefSerializer.scala | 18 +- .../pekko/stream/stage/GraphStage.scala | 56 +++---- .../pekko/stream/stage/StageLogging.scala | 2 +- .../pekko/testkit/TestEventListener.scala | 8 +- .../pekko/testkit/TestJavaSerializer.scala | 2 +- .../org/apache/pekko/testkit/TestKit.scala | 18 +- .../apache/pekko/testkit/TestKitUtils.scala | 2 +- .../pekko/testkit/javadsl/EventFilter.scala | 10 +- .../pekko/testkit/javadsl/TestKit.scala | 6 +- .../org/apache/pekko/testkit/PekkoSpec.scala | 8 +- .../pekko/testkit/TestActorRefSpec.scala | 2 +- .../reporter/PekkoConsoleReporter.scala | 6 +- 400 files changed, 1700 insertions(+), 1700 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 28887d6cb00..907e8dc6e97 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 @@ -45,7 +45,7 @@ object Effect { with Serializable { override def equals(other: Any) = other match { - case o: Spawned[_] => + case o: Spawned[?] => this.behavior == o.behavior && this.childName == o.childName && this.props == o.props @@ -58,7 +58,7 @@ object Effect { override def _1: Behavior[T] = behavior override def _2: String = childName override def _3: Props = props - override def canEqual(o: Any) = o.isInstanceOf[Spawned[_]] + override def canEqual(o: Any) = o.isInstanceOf[Spawned[?]] } object Spawned { @@ -76,7 +76,7 @@ object Effect { with Serializable { override def equals(other: Any) = other match { - case o: SpawnedAnonymous[_] => this.behavior == o.behavior && this.props == o.props + case o: SpawnedAnonymous[?] => this.behavior == o.behavior && this.props == o.props case _ => false } override def hashCode: Int = behavior.## * 31 + props.## @@ -85,7 +85,7 @@ object Effect { override def productPrefix = "SpawnedAnonymous" override def _1: Behavior[T] = behavior override def _2: Props = props - override def canEqual(o: Any) = o.isInstanceOf[SpawnedAnonymous[_]] + override def canEqual(o: Any) = o.isInstanceOf[SpawnedAnonymous[?]] } object SpawnedAnonymous { @@ -105,7 +105,7 @@ object Effect { with Serializable { override def equals(other: Any) = other match { - case o: SpawnedAdapter[_] => this.name == o.name + case o: SpawnedAdapter[?] => this.name == o.name case _ => false } override def hashCode: Int = name.## @@ -113,7 +113,7 @@ object Effect { override def productPrefix = "SpawnedAdapter" override def _1: String = name - override def canEqual(o: Any) = o.isInstanceOf[SpawnedAdapter[_]] + override def canEqual(o: Any) = o.isInstanceOf[SpawnedAdapter[?]] } /** @@ -137,17 +137,17 @@ object Effect { with Serializable { override def equals(other: Any): Boolean = other match { - case _: SpawnedAnonymousAdapter[_] => true + case _: SpawnedAnonymousAdapter[?] => true case _ => false } override def hashCode: Int = Nil.## override def toString: String = "SpawnedAnonymousAdapter" override def productPrefix: String = "SpawnedAnonymousAdapter" - override def productIterator: Iterator[_] = Iterator.empty + override def productIterator: Iterator[?] = Iterator.empty override def productArity: Int = 0 override def productElement(n: Int) = throw new NoSuchElementException - override def canEqual(o: Any): Boolean = o.isInstanceOf[SpawnedAnonymousAdapter[_]] + override def canEqual(o: Any): Boolean = o.isInstanceOf[SpawnedAnonymousAdapter[?]] } /** diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/TestKitSettings.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/TestKitSettings.scala index 8de5d2b9e41..195d40c101a 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/TestKitSettings.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/TestKitSettings.scala @@ -29,7 +29,7 @@ object TestKitSettings { /** * Reads configuration settings from `pekko.actor.testkit.typed` section. */ - def apply(system: ActorSystem[_]): TestKitSettings = + def apply(system: ActorSystem[?]): TestKitSettings = Ext(system).settings /** @@ -42,7 +42,7 @@ object TestKitSettings { /** * Java API: Reads configuration settings from `pekko.actor.testkit.typed` section. */ - def create(system: ActorSystem[_]): TestKitSettings = + def create(system: ActorSystem[?]): TestKitSettings = apply(system) /** @@ -53,11 +53,11 @@ object TestKitSettings { new TestKitSettings(config) private object Ext extends ExtensionId[Ext] { - override def createExtension(system: ActorSystem[_]): Ext = new Ext(system) - def get(system: ActorSystem[_]): Ext = Ext.apply(system) + override def createExtension(system: ActorSystem[?]): Ext = new Ext(system) + def get(system: ActorSystem[?]): Ext = Ext.apply(system) } - private class Ext(system: ActorSystem[_]) extends Extension { + private class Ext(system: ActorSystem[?]) extends Extension { val settings: TestKitSettings = TestKitSettings(system.settings.config.getConfig("pekko.actor.testkit.typed")) } } diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/ActorSystemStub.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/ActorSystemStub.scala index ff13e3aa56d..c794fe52095 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/ActorSystemStub.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/ActorSystemStub.scala @@ -127,7 +127,7 @@ import pekko.util.FutureConverters._ override def extension[T <: Extension](ext: ExtensionId[T]): T = throw new UnsupportedOperationException("ActorSystemStub cannot register extensions") - override def hasExtension(ext: ExtensionId[_ <: Extension]): Boolean = + override def hasExtension(ext: ExtensionId[? <: Extension]): Boolean = throw new UnsupportedOperationException("ActorSystemStub cannot register extensions") override def log: Logger = LoggerFactory.getLogger(getClass) diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/LoggingTestKitImpl.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/LoggingTestKitImpl.scala index 555c4c4c220..3a23dd131e2 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/LoggingTestKitImpl.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/LoggingTestKitImpl.scala @@ -48,7 +48,7 @@ import pekko.testkit.TestKit source: Option[String], messageContains: Option[String], messageRegex: Option[Regex], - cause: Option[Class[_ <: Throwable]], + cause: Option[Class[? <: Throwable]], mdc: Map[String, String], checkExcess: Boolean, custom: Option[Function[LoggingEvent, Boolean]]) @@ -95,7 +95,7 @@ import pekko.testkit.TestKit todo > 0 } - override def expect[T](code: => T)(implicit system: ActorSystem[_]): T = { + override def expect[T](code: => T)(implicit system: ActorSystem[?]): T = { val effectiveLoggerName = loggerName.getOrElse("") checkLogback(system) TestAppender.setupTestAppender(effectiveLoggerName) @@ -120,14 +120,14 @@ import pekko.testkit.TestKit } } - override def expect[T](system: ActorSystem[_], code: Supplier[T]): T = + override def expect[T](system: ActorSystem[?], code: Supplier[T]): T = expect(code.get())(system) // deprecated (renamed to expect) - override def intercept[T](code: => T)(implicit system: ActorSystem[_]): T = + override def intercept[T](code: => T)(implicit system: ActorSystem[?]): T = expect(code)(system) - private def checkLogback(system: ActorSystem[_]): Unit = { + private def checkLogback(system: ActorSystem[?]): Unit = { if (!system.dynamicAccess.classIsOnClasspath("ch.qos.logback.classic.spi.ILoggingEvent")) { throw new IllegalStateException("LoggingEventFilter requires logback-classic dependency in classpath.") } @@ -170,7 +170,7 @@ import pekko.testkit.TestKit override def withCustom(newCustom: Function[LoggingEvent, Boolean]): LoggingTestKitImpl = copy(custom = Option(newCustom)) - override def withCause(newCause: Class[_ <: Throwable]): javadsl.LoggingTestKit = + override def withCause(newCause: Class[? <: Throwable]): javadsl.LoggingTestKit = copy(cause = Option(newCause)) } diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/StubbedActorContext.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/StubbedActorContext.scala index 51314acafcb..b069ecd04b6 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/StubbedActorContext.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/StubbedActorContext.scala @@ -88,7 +88,7 @@ private[pekko] final class FunctionRef[-T](override val path: ActorPath, send: ( @InternalApi private[pekko] val selfInbox = new TestInboxImpl[T](path) override val self = selfInbox.ref - private var _children = TreeMap.empty[String, BehaviorTestKitImpl[_]] + private var _children = TreeMap.empty[String, BehaviorTestKitImpl[?]] private val childName = Iterator.from(0).map(Helpers.base64(_)) private val substituteLoggerFactory = new SubstituteLoggerFactory private val logger: Logger = substituteLoggerFactory.getLogger("StubbedLogger") @@ -228,7 +228,7 @@ private[pekko] final class FunctionRef[-T](override val path: ActorPath, send: ( checkCurrentActorThread() } - override def setLoggerName(clazz: Class[_]): Unit = { + override def setLoggerName(clazz: Class[?]): Unit = { // nop as we don't track logger checkCurrentActorThread() } diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/TestKitUtils.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/TestKitUtils.scala index e54319dae00..6cc2da25997 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/TestKitUtils.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/TestKitUtils.scala @@ -79,7 +79,7 @@ private[pekko] object TestKitUtils { // common internal utility impls for Java and Scala private val TestKitRegex = """org\.apache\.pekko\.testkit\.typed\.(?:javadsl|scaladsl)\.ActorTestKit(?:\$.*)?""".r - def testNameFromCallStack(classToStartFrom: Class[_]): String = + def testNameFromCallStack(classToStartFrom: Class[?]): String = pekko.testkit.TestKitUtils.testNameFromCallStack(classToStartFrom, TestKitRegex) /** @@ -90,7 +90,7 @@ private[pekko] object TestKitUtils { def scrubActorSystemName(name: String): String = pekko.testkit.TestKitUtils.scrubActorSystemName(name) - def shutdown(system: ActorSystem[_], timeout: Duration, throwIfShutdownTimesOut: Boolean): Unit = { + def shutdown(system: ActorSystem[?], timeout: Duration, throwIfShutdownTimesOut: Boolean): Unit = { system.terminate() try Await.ready(system.whenTerminated, timeout) catch { diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/TestProbeImpl.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/TestProbeImpl.scala index e39be95ba2a..76aace42c93 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/TestProbeImpl.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/TestProbeImpl.scala @@ -74,7 +74,7 @@ private[pekko] object TestProbeImpl { } @InternalApi -private[pekko] final class TestProbeImpl[M](name: String, system: ActorSystem[_]) +private[pekko] final class TestProbeImpl[M](name: String, system: ActorSystem[?]) extends JavaTestProbe[M] with ScalaTestProbe[M] with InternalRecipientRef[M] { diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/ActorTestKit.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/ActorTestKit.scala index 6b067707564..6b4504881ca 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/ActorTestKit.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/ActorTestKit.scala @@ -56,7 +56,7 @@ object ActorTestKit { * Config loaded from the provided actor if that exists, otherwise * using default configuration from the reference.conf resources that ship with the Akka libraries. */ - def create(system: ActorSystem[_]): ActorTestKit = + def create(system: ActorSystem[?]): ActorTestKit = new ActorTestKit(scaladsl.ActorTestKit(system)) /** @@ -122,7 +122,7 @@ object ActorTestKit { * an error is printed to stdout when the system did not shutdown but * no exception is thrown. */ - def shutdown(system: ActorSystem[_], duration: Duration, throwIfShutdownTimesOut: Boolean): Unit = { + def shutdown(system: ActorSystem[?], duration: Duration, throwIfShutdownTimesOut: Boolean): Unit = { TestKitUtils.shutdown(system, duration.asScala, throwIfShutdownTimesOut) } @@ -131,7 +131,7 @@ object ActorTestKit { * if more time than `system-shutdown-default` passes an exception is thrown * (can be configured with `throw-on-shutdown-timeout`). */ - def shutdown(system: ActorSystem[_], duration: Duration): Unit = { + def shutdown(system: ActorSystem[?], duration: Duration): Unit = { val settings = TestKitSettings.create(system) shutdown(system, duration, settings.ThrowOnShutdownTimeout) } @@ -141,7 +141,7 @@ object ActorTestKit { * if more time than `system-shutdown-default` passes an exception is thrown * (can be configured with `throw-on-shutdown-timeout`). */ - def shutdown(system: ActorSystem[_]): Unit = { + def shutdown(system: ActorSystem[?]): Unit = { val settings = TestKitSettings.create(system) shutdown(system, settings.DefaultActorSystemShutdownTimeout.asJava, settings.ThrowOnShutdownTimeout) } diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/JUnit5TestKitBuilder.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/JUnit5TestKitBuilder.scala index ac3ae80e6e9..d306d4e3b46 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/JUnit5TestKitBuilder.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/JUnit5TestKitBuilder.scala @@ -25,13 +25,13 @@ import pekko.actor.typed.ActorSystem final class JUnit5TestKitBuilder() { - var system: Option[ActorSystem[_]] = None + var system: Option[ActorSystem[?]] = None var customConfig: Config = ApplicationTestConfig var name: String = TestKitUtils.testNameFromCallStack(classOf[JUnit5TestKitBuilder]) - def withSystem(system: ActorSystem[_]): JUnit5TestKitBuilder = { + def withSystem(system: ActorSystem[?]): JUnit5TestKitBuilder = { this.system = Some(system) this } diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/LoggingTestKit.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/LoggingTestKit.scala index 837edc09c8a..8aabd0d7a99 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/LoggingTestKit.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/LoggingTestKit.scala @@ -78,7 +78,7 @@ import pekko.annotation.DoNotInherit * Matching events with an included `throwable` that is a class or subclass of the given * `Throwable` class. */ - def withCause(newCause: Class[_ <: Throwable]): LoggingTestKit + def withCause(newCause: Class[? <: Throwable]): LoggingTestKit /** * Matching events with MDC containing all entries of the given `Map`. @@ -109,7 +109,7 @@ import pekko.annotation.DoNotInherit * * Care is taken to remove the testkit when the block is finished or aborted. */ - def expect[T](system: ActorSystem[_], code: Supplier[T]): T + def expect[T](system: ActorSystem[?], code: Supplier[T]): T } @@ -198,7 +198,7 @@ object LoggingTestKit { * * More conditions can be added to the returned [LoggingEventFilter]. */ - def error(causeClass: Class[_ <: Throwable]): LoggingTestKit = + def error(causeClass: Class[? <: Throwable]): LoggingTestKit = empty.withLogLevel(Level.ERROR).withCause(causeClass) /** diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/ManualTime.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/ManualTime.scala index 477265858e2..417b72ce9b4 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/ManualTime.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/ManualTime.scala @@ -73,7 +73,7 @@ final class ManualTime(delegate: pekko.testkit.ExplicitlyTriggeredScheduler) { def timePasses(amount: Duration): Unit = delegate.timePasses(amount.asScala) @varargs - def expectNoMessageFor(duration: Duration, on: TestProbe[_]*): Unit = { + def expectNoMessageFor(duration: Duration, on: TestProbe[?]*): Unit = { delegate.timePasses(duration.asScala) on.foreach(_.expectNoMessage(Duration.ZERO)) } diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/SerializationTestKit.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/SerializationTestKit.scala index 16b47af91c8..768e5c7ab85 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/SerializationTestKit.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/SerializationTestKit.scala @@ -20,7 +20,7 @@ import pekko.actor.typed.ActorSystem /** * Utilities to test serialization. */ -class SerializationTestKit(system: ActorSystem[_]) { +class SerializationTestKit(system: ActorSystem[?]) { private val delegate = new scaladsl.SerializationTestKit(system) diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/TestKitJunitResource.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/TestKitJunitResource.scala index ad7e445b6bb..3dfda8fdff5 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/TestKitJunitResource.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/TestKitJunitResource.scala @@ -71,7 +71,7 @@ final class TestKitJunitResource(_kit: ActorTestKit) extends ExternalResource { /** * Use a custom [[pekko.actor.typed.ActorSystem]] for the actor system. */ - def this(system: ActorSystem[_]) = this(ActorTestKit.create(system)) + def this(system: ActorSystem[?]) = this(ActorTestKit.create(system)) /** * Use a custom config for the actor system. 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 1d7bf621221..44f3936d653 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 @@ -54,16 +54,16 @@ object FishingOutcomes { object TestProbe { - def create[M](system: ActorSystem[_]): TestProbe[M] = + def create[M](system: ActorSystem[?]): TestProbe[M] = create(name = "testProbe", system) - def create[M](@unused clazz: Class[M], system: ActorSystem[_]): TestProbe[M] = + def create[M](@unused clazz: Class[M], system: ActorSystem[?]): TestProbe[M] = create(system) - def create[M](name: String, system: ActorSystem[_]): TestProbe[M] = + def create[M](name: String, system: ActorSystem[?]): TestProbe[M] = new TestProbeImpl[M](name, system) - def create[M](name: String, @unused clazz: Class[M], system: ActorSystem[_]): TestProbe[M] = + def create[M](name: String, @unused clazz: Class[M], system: ActorSystem[?]): TestProbe[M] = new TestProbeImpl[M](name, system) } diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/ActorTestKit.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/ActorTestKit.scala index ffad923a50d..991cd647309 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/ActorTestKit.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/ActorTestKit.scala @@ -74,7 +74,7 @@ object ActorTestKit { * Config loaded from the provided actor if that exists, otherwise * using default configuration from the reference.conf resources that ship with the Akka libraries. */ - def apply(system: ActorSystem[_]): ActorTestKit = { + def apply(system: ActorSystem[?]): ActorTestKit = { val name = testKitGuardianCounter.incrementAndGet() match { case 1 => "test" case n => s"test-$n" @@ -159,7 +159,7 @@ object ActorTestKit { * Shutdown the given [[pekko.actor.typed.ActorSystem]] and block until it shuts down, * if more time than `TestKitSettings.DefaultActorSystemShutdownTimeout` passes an exception is thrown */ - def shutdown(system: ActorSystem[_]): Unit = { + def shutdown(system: ActorSystem[?]): Unit = { val settings = TestKitSettings(system) TestKitUtils.shutdown(system, settings.DefaultActorSystemShutdownTimeout, settings.ThrowOnShutdownTimeout) } @@ -168,7 +168,7 @@ object ActorTestKit { * Shutdown the given [[pekko.actor.typed.ActorSystem]] and block until it shuts down * or the `duration` hits. If the timeout hits `verifySystemShutdown` decides */ - def shutdown(system: ActorSystem[_], timeout: Duration, throwIfShutdownFails: Boolean = false): Unit = + def shutdown(system: ActorSystem[?], timeout: Duration, throwIfShutdownFails: Boolean = false): Unit = TestKitUtils.shutdown(system, timeout, throwIfShutdownFails) /** @@ -192,7 +192,7 @@ object ActorTestKit { * For synchronous testing of a `Behavior` see [[BehaviorTestKit]] */ final class ActorTestKit private[pekko] ( - val internalSystem: ActorSystem[_], + val internalSystem: ActorSystem[?], internalTestKitGuardian: ActorRef[ActorTestKitGuardian.TestKitCommand], settings: Option[TestKitSettings]) { diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/LoggingTestKit.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/LoggingTestKit.scala index 5de7cf006db..e4a41ad7868 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/LoggingTestKit.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/LoggingTestKit.scala @@ -108,7 +108,7 @@ import pekko.annotation.DoNotInherit * * Care is taken to remove the testkit when the block is finished or aborted. */ - def expect[T](code: => T)(implicit system: ActorSystem[_]): T + def expect[T](code: => T)(implicit system: ActorSystem[?]): T /** * Run the given code block and assert that the criteria of this `LoggingTestKit` has @@ -118,7 +118,7 @@ import pekko.annotation.DoNotInherit * Care is taken to remove the testkit when the block is finished or aborted. */ @deprecated("Use expect instead.", "Akka 2.6.0") - def intercept[T](code: => T)(implicit system: ActorSystem[_]): T + def intercept[T](code: => T)(implicit system: ActorSystem[?]): T } diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/ManualTime.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/ManualTime.scala index 426a579d90a..1b03a3296fa 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/ManualTime.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/ManualTime.scala @@ -41,7 +41,7 @@ object ManualTime { * Access the manual scheduler, note that you need to setup the actor system/testkit with [[ManualTime.config]] * for this to work. */ - def apply()(implicit system: ActorSystem[_]): ManualTime = + def apply()(implicit system: ActorSystem[?]): ManualTime = system.scheduler match { case adapter: SchedulerAdapter => adapter.classicScheduler match { @@ -73,7 +73,7 @@ final class ManualTime(delegate: pekko.testkit.ExplicitlyTriggeredScheduler) { def timePasses(amount: FiniteDuration): Unit = delegate.timePasses(amount) @varargs - def expectNoMessageFor(duration: FiniteDuration, on: TestProbe[_]*): Unit = { + def expectNoMessageFor(duration: FiniteDuration, on: TestProbe[?]*): Unit = { delegate.timePasses(duration) on.foreach(_.expectNoMessage(Duration.Zero)) } diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/ScalaTestWithActorTestKit.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/ScalaTestWithActorTestKit.scala index ee244dff23e..fb6bef609c9 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/ScalaTestWithActorTestKit.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/ScalaTestWithActorTestKit.scala @@ -52,7 +52,7 @@ abstract class ScalaTestWithActorTestKit(override val testKit: ActorTestKit) /** * Use a custom [[pekko.actor.typed.ActorSystem]] for the actor system. */ - def this(system: ActorSystem[_]) = this(ActorTestKit(system)) + def this(system: ActorSystem[?]) = this(ActorTestKit(system)) /** * Use a custom config for the actor system. diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/SerializationTestKit.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/SerializationTestKit.scala index 84ecfb2adf9..691291aa15d 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/SerializationTestKit.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/SerializationTestKit.scala @@ -22,7 +22,7 @@ import pekko.serialization.Serializers /** * Utilities to test serialization. */ -class SerializationTestKit(system: ActorSystem[_]) { +class SerializationTestKit(system: ActorSystem[?]) { private val serialization = SerializationExtension(system.toClassic) diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/TestProbe.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/TestProbe.scala index 322f9a71723..2f93ba7daf5 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/TestProbe.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/TestProbe.scala @@ -52,10 +52,10 @@ object FishingOutcomes { } object TestProbe { - def apply[M]()(implicit system: ActorSystem[_]): TestProbe[M] = + def apply[M]()(implicit system: ActorSystem[?]): TestProbe[M] = apply(name = "testProbe") - def apply[M](name: String)(implicit system: ActorSystem[_]): TestProbe[M] = + def apply[M](name: String)(implicit system: ActorSystem[?]): TestProbe[M] = new TestProbeImpl[M](name, system) } diff --git a/actor-testkit-typed/src/test/scala/docs/org/apache/pekko/actor/testkit/typed/scaladsl/SyncTestingExampleSpec.scala b/actor-testkit-typed/src/test/scala/docs/org/apache/pekko/actor/testkit/typed/scaladsl/SyncTestingExampleSpec.scala index 3d9c880c954..6a1045039a1 100644 --- a/actor-testkit-typed/src/test/scala/docs/org/apache/pekko/actor/testkit/typed/scaladsl/SyncTestingExampleSpec.scala +++ b/actor-testkit-typed/src/test/scala/docs/org/apache/pekko/actor/testkit/typed/scaladsl/SyncTestingExampleSpec.scala @@ -162,10 +162,10 @@ class SyncTestingExampleSpec extends AnyWordSpec with Matchers { testKit.run(ConfigAware.SpawnChild(inbox.ref.narrow)) val childTestKit = inbox.receiveMessage() match { - case ar: ActorRef[_] => + case ar: ActorRef[?] => testKit.childTestKit(ar.unsafeUpcast[Any].narrow[ConfigAware.Command]) case unexpected => - unexpected should be(a[ActorRef[_]]) + unexpected should be(a[ActorRef[?]]) ??? } diff --git a/actor-testkit-typed/src/test/scala/org/apache/pekko/actor/testkit/typed/scaladsl/ActorTestKitSpec.scala b/actor-testkit-typed/src/test/scala/org/apache/pekko/actor/testkit/typed/scaladsl/ActorTestKitSpec.scala index c3cdc0eb79b..cf1bff5c74f 100644 --- a/actor-testkit-typed/src/test/scala/org/apache/pekko/actor/testkit/typed/scaladsl/ActorTestKitSpec.scala +++ b/actor-testkit-typed/src/test/scala/org/apache/pekko/actor/testkit/typed/scaladsl/ActorTestKitSpec.scala @@ -55,7 +55,7 @@ class ActorTestKitSpec extends ScalaTestWithActorTestKit with AnyWordSpecLike wi } "use name from given class name with replaced package name" in { - val testkit2 = ActorTestKit(classOf[Vector[_]].getName) + val testkit2 = ActorTestKit(classOf[Vector[?]].getName) try { // removing package name and such testkit2.system.name should ===("Vector") @@ -170,7 +170,7 @@ class MyConcreteDerivateSpec extends MyBaseSpec { } "use name from given class name" in { - val testkit2 = ActorTestKit(classOf[Vector[_]].getName) + val testkit2 = ActorTestKit(classOf[Vector[?]].getName) try { testkit2.system.name should ===("Vector") } finally testkit2.shutdownTestKit() diff --git a/actor-testkit-typed/src/test/scala/org/apache/pekko/actor/testkit/typed/scaladsl/BehaviorTestKitSpec.scala b/actor-testkit-typed/src/test/scala/org/apache/pekko/actor/testkit/typed/scaladsl/BehaviorTestKitSpec.scala index 9b531e75bc9..4b04f488701 100644 --- a/actor-testkit-typed/src/test/scala/org/apache/pekko/actor/testkit/typed/scaladsl/BehaviorTestKitSpec.scala +++ b/actor-testkit-typed/src/test/scala/org/apache/pekko/actor/testkit/typed/scaladsl/BehaviorTestKitSpec.scala @@ -186,7 +186,7 @@ class BehaviorTestKitSpec extends AnyWordSpec with Matchers with LogCapturing { "allow assertions on effect type" in { val testkit = BehaviorTestKit[Parent.Command](Parent.init) testkit.run(SpawnAnonymous(1)) - val spawnAnonymous = testkit.expectEffectType[Effect.SpawnedAnonymous[_]] + val spawnAnonymous = testkit.expectEffectType[Effect.SpawnedAnonymous[?]] spawnAnonymous.props should ===(Props.empty) } @@ -378,7 +378,7 @@ class BehaviorTestKitSpec extends AnyWordSpec with Matchers with LogCapturing { val sessionRef = i.receiveMessage() i.hasMessages shouldBe false - val s = testkit.expectEffectType[SpawnedAnonymous[_]] + val s = testkit.expectEffectType[SpawnedAnonymous[?]] // must be able to get the created ref, even without explicit reply s.ref shouldBe sessionRef @@ -402,7 +402,7 @@ class BehaviorTestKitSpec extends AnyWordSpec with Matchers with LogCapturing { testkit.expectEffect(Stopped(child.childName)) testkit.run(SpawnChild) - val newChild = testkit.expectEffectType[Spawned[_]] + val newChild = testkit.expectEffectType[Spawned[?]] child.childName shouldBe newChild.childName } } diff --git a/actor-tests/src/test/scala/org/apache/pekko/PekkoExceptionSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/PekkoExceptionSpec.scala index 79439d1cb44..c8a2e59039a 100644 --- a/actor-tests/src/test/scala/org/apache/pekko/PekkoExceptionSpec.scala +++ b/actor-tests/src/test/scala/org/apache/pekko/PekkoExceptionSpec.scala @@ -36,7 +36,7 @@ class PekkoExceptionSpec extends AnyWordSpec with Matchers { } } - def verify(clazz: java.lang.Class[_]): Unit = { + def verify(clazz: java.lang.Class[?]): Unit = { clazz.getConstructor(Array(classOf[String]): _*) } } 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 99222249ff8..83b60916b90 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 @@ -241,7 +241,7 @@ class ActorMailboxSpec(conf: Config) extends PekkoSpec(conf) with DefaultTimeout def this() = this(ActorMailboxSpec.mailboxConf) - def checkMailboxQueue(props: Props, name: String, types: Seq[Class[_]]): MessageQueue = { + def checkMailboxQueue(props: Props, name: String, types: Seq[Class[?]]): MessageQueue = { val actor = system.actorOf(props, name) actor ! "ping" diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/DynamicAccessSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/DynamicAccessSpec.scala index 4b84be70c79..318022e23b8 100644 --- a/actor-tests/src/test/scala/org/apache/pekko/actor/DynamicAccessSpec.scala +++ b/actor-tests/src/test/scala/org/apache/pekko/actor/DynamicAccessSpec.scala @@ -82,7 +82,7 @@ class DynamicAccessSpec extends AnyWordSpec with Matchers with BeforeAndAfterAll case Failure(_: NoSuchMethodException) => dynamicAccess .createInstanceFor[TestSuperclass](fqcn, immutable.Seq((classOf[String], "string ctor argument"))) - case f: Failure[_] => f + case f: Failure[?] => f } } diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/ExtensionSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/ExtensionSpec.scala index a5b6ca78ec4..6c397896c3f 100644 --- a/actor-tests/src/test/scala/org/apache/pekko/actor/ExtensionSpec.scala +++ b/actor-tests/src/test/scala/org/apache/pekko/actor/ExtensionSpec.scala @@ -45,7 +45,7 @@ object InstanceCountingExtension extends ExtensionId[InstanceCountingExtension] override def createExtension(system: ExtendedActorSystem): InstanceCountingExtension = { new InstanceCountingExtension } - override def lookup: ExtensionId[_ <: Extension] = this + override def lookup: ExtensionId[? <: Extension] = this } class InstanceCountingExtension extends Extension { diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/SupervisorHierarchySpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/SupervisorHierarchySpec.scala index 2ed576a222e..fb88399c32c 100644 --- a/actor-tests/src/test/scala/org/apache/pekko/actor/SupervisorHierarchySpec.scala +++ b/actor-tests/src/test/scala/org/apache/pekko/actor/SupervisorHierarchySpec.scala @@ -928,8 +928,8 @@ class SupervisorHierarchySpec extends PekkoSpec(SupervisorHierarchySpec.config) fsm ! FSM.SubscribeTransitionCallBack(system.actorOf(Props(new Actor { def receive = { - case s: FSM.CurrentState[_] => log.info("{}", s) - case t: FSM.Transition[_] => log.info("{}", t) + case s: FSM.CurrentState[?] => log.info("{}", s) + case t: FSM.Transition[?] => log.info("{}", t) } }))) diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/TypedActorSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/TypedActorSpec.scala index 828fd86c510..0fb7eaa2784 100644 --- a/actor-tests/src/test/scala/org/apache/pekko/actor/TypedActorSpec.scala +++ b/actor-tests/src/test/scala/org/apache/pekko/actor/TypedActorSpec.scala @@ -411,7 +411,7 @@ class TypedActorSpec case e: IllegalStateException if e.getMessage == "expected" => SupervisorStrategy.Resume } def receive = { - case p: TypedProps[_] => context.sender() ! pekko.actor.TypedActor(context).typedActorOf(p) + case p: TypedProps[?] => context.sender() ! pekko.actor.TypedActor(context).typedActorOf(p) } })) val t = Await.result( @@ -512,7 +512,7 @@ class TypedActorSpec val m = pekko.actor.TypedActor.MethodCall( classOf[Foo].getDeclaredMethod( "testMethodCallSerialization", - Array[Class[_]](classOf[Foo], classOf[String], classOf[Int], classOf[WithStringSerializedClass]): _*), + Array[Class[?]](classOf[Foo], classOf[String], classOf[Int], classOf[WithStringSerializedClass]): _*), Array[AnyRef](someFoo, null, 1.asInstanceOf[AnyRef], WithStringSerializedClass())) val baos = new ByteArrayOutputStream(8192 * 4) val out = new ObjectOutputStream(baos) 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 02ae1a5624b..d92c7c745e2 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 @@ -128,7 +128,7 @@ abstract class MailboxSpec extends PekkoSpec with BeforeAndAfterAll with BeforeA def ensureInitialMailboxState(config: MailboxType, q: MessageQueue): Unit = { q should not be null q match { - case aQueue: BlockingQueue[_] => + case aQueue: BlockingQueue[?] => config match { case BoundedMailbox(capacity, _) => aQueue.remainingCapacity should ===(capacity) case UnboundedMailbox() => aQueue.remainingCapacity should ===(Int.MaxValue) diff --git a/actor-tests/src/test/scala/org/apache/pekko/pattern/StatusReplySpec.scala b/actor-tests/src/test/scala/org/apache/pekko/pattern/StatusReplySpec.scala index cc0cffb91c0..c1cce80d8bc 100644 --- a/actor-tests/src/test/scala/org/apache/pekko/pattern/StatusReplySpec.scala +++ b/actor-tests/src/test/scala/org/apache/pekko/pattern/StatusReplySpec.scala @@ -44,7 +44,7 @@ class StatusReplySpec extends PekkoSpec with ScalaFutures { } } "not throw exception if null" in { - (null: StatusReply[_]) match { + (null: StatusReply[?]) match { case StatusReply.Success(_) => fail() case StatusReply.Error(_) => fail() case _ => diff --git a/actor-tests/src/test/scala/org/apache/pekko/serialization/SerializationSetupSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/serialization/SerializationSetupSpec.scala index 9b8aac0896f..2ca2470f39a 100644 --- a/actor-tests/src/test/scala/org/apache/pekko/serialization/SerializationSetupSpec.scala +++ b/actor-tests/src/test/scala/org/apache/pekko/serialization/SerializationSetupSpec.scala @@ -46,7 +46,7 @@ final class FakeSerializer extends Serializer { Array(id.toByte) } - def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]) = { + def fromBinary(bytes: Array[Byte], clazz: Option[Class[?]]) = { require(bytes.length == 1) val id = bytes(0).toInt registry.get(id) 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 3a5cc4adef3..f05fd5c4b2b 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 @@ -365,7 +365,7 @@ class VerifySerializabilitySpec extends PekkoSpec(SerializationTests.verifySeria class ReferenceSerializationSpec extends PekkoSpec(SerializationTests.mostlyReferenceSystem) { val ser = SerializationExtension(system) - def serializerMustBe(toSerialize: Class[_], expectedSerializer: Class[_]) = + def serializerMustBe(toSerialize: Class[?], expectedSerializer: Class[?]) = ser.serializerFor(toSerialize).getClass should ===(expectedSerializer) "Serialization settings from reference.conf" must { @@ -403,7 +403,7 @@ class ReferenceSerializationSpec extends PekkoSpec(SerializationTests.mostlyRefe class AllowJavaSerializationSpec extends PekkoSpec(SerializationTests.allowJavaSerializationSystem) { val ser = SerializationExtension(system) - def serializerMustBe(toSerialize: Class[_], expectedSerializer: Class[_]) = + def serializerMustBe(toSerialize: Class[?], expectedSerializer: Class[?]) = ser.serializerFor(toSerialize).getClass should ===(expectedSerializer) val address = SerializationTests.Address("120", "Monroe Street", "Santa Clara", "95050") @@ -596,7 +596,7 @@ protected[pekko] class NoopSerializer extends Serializer { Array.empty[Byte] } - def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = null + def fromBinary(bytes: Array[Byte], clazz: Option[Class[?]]): AnyRef = null } protected[pekko] class NoopSerializer2 extends Serializer { @@ -608,7 +608,7 @@ protected[pekko] class NoopSerializer2 extends Serializer { Array.empty[Byte] } - def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = null + def fromBinary(bytes: Array[Byte], clazz: Option[Class[?]]): AnyRef = null } protected[pekko] class NoopSerializerSameId extends NoopSerializer @@ -629,5 +629,5 @@ class DeadlockSerializer(system: ExtendedActorSystem) extends Serializer { def toBinary(o: AnyRef): Array[Byte] = Array.empty[Byte] - def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = null + def fromBinary(bytes: Array[Byte], clazz: Option[Class[?]]): AnyRef = null } 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 1302cae07a7..3ea6b3dc8bf 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 @@ -740,7 +740,7 @@ trait BlockingHelpers { /** * Check that a Future does not complete within a set timespan. */ - def mustBlockFor(timeout: Span, action: Future[_])(implicit pos: Position): Unit = + def mustBlockFor(timeout: Span, action: Future[?])(implicit pos: Position): Unit = Exception.ignoring(classOf[TimeoutException]) { Await.ready(action, timeout) fail("Expected action to block for at least " + timeout.prettyString + " but it completed.") diff --git a/actor-tests/src/test/scala/org/apache/pekko/util/ByteStringInitializationSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/util/ByteStringInitializationSpec.scala index 9c2b52a2ce2..d3d4c6e2269 100644 --- a/actor-tests/src/test/scala/org/apache/pekko/util/ByteStringInitializationSpec.scala +++ b/actor-tests/src/test/scala/org/apache/pekko/util/ByteStringInitializationSpec.scala @@ -29,7 +29,7 @@ class ByteStringInitializationSpec extends AnyWordSpec with Matchers { val cleanCl = new ClassLoader(null) { val outerCl = ByteStringInitializationSpec.this.getClass.getClassLoader val buffer = new Array[Byte](1000000) - override def loadClass(name: String): Class[_] = + override def loadClass(name: String): Class[?] = if (!name.startsWith("org.apache.pekko")) outerCl.loadClass(name) else { val classFile = name.replace(".", "/") + ".class" diff --git a/actor-tests/src/test/scala/org/apache/pekko/util/ByteStringSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/util/ByteStringSpec.scala index d7233507597..0f99c00afc0 100644 --- a/actor-tests/src/test/scala/org/apache/pekko/util/ByteStringSpec.scala +++ b/actor-tests/src/test/scala/org/apache/pekko/util/ByteStringSpec.scala @@ -196,7 +196,7 @@ class ByteStringSpec extends AnyWordSpec with Matchers with Checkers { (!strict || (bsAIt.toSeq -> bsBIt.toSeq) == (vecAIt.toSeq -> vecBIt.toSeq)) } - def likeVecBld(body: Builder[Byte, _] => Unit): Boolean = { + def likeVecBld(body: Builder[Byte, ?] => Unit): Boolean = { val bsBuilder = ByteString.newBuilder val vecBuilder = Vector.newBuilder[Byte] diff --git a/actor-tests/src/test/scala/org/apache/pekko/util/WildcardIndexSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/util/WildcardIndexSpec.scala index 7757db7dafb..9ee1fe4bae3 100644 --- a/actor-tests/src/test/scala/org/apache/pekko/util/WildcardIndexSpec.scala +++ b/actor-tests/src/test/scala/org/apache/pekko/util/WildcardIndexSpec.scala @@ -20,9 +20,9 @@ class WildcardIndexSpec extends AnyWordSpec with Matchers { "wildcard index" must { "allow to insert elements using Arrays of strings" in { - emptyIndex.insert(Array("a", "b"), 1) shouldBe a[WildcardIndex[_]] - emptyIndex.insert(Array("a"), 1) shouldBe a[WildcardIndex[_]] - emptyIndex.insert(Array.empty[String], 1) shouldBe a[WildcardIndex[_]] + emptyIndex.insert(Array("a", "b"), 1) shouldBe a[WildcardIndex[?]] + emptyIndex.insert(Array("a"), 1) shouldBe a[WildcardIndex[?]] + emptyIndex.insert(Array.empty[String], 1) shouldBe a[WildcardIndex[?]] } "allow to find inserted elements" in { diff --git a/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/InteractionPatternsSpec.scala b/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/InteractionPatternsSpec.scala index 72cc863d3af..f1449531fd5 100644 --- a/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/InteractionPatternsSpec.scala +++ b/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/InteractionPatternsSpec.scala @@ -498,7 +498,7 @@ class InteractionPatternsSpec extends ScalaTestWithActorTestKit with AnyWordSpec // the ask is failed with a TimeoutException implicit val timeout: Timeout = 3.seconds // implicit ActorSystem in scope - implicit val system: ActorSystem[_] = theSystem + implicit val system: ActorSystem[?] = theSystem val result: Future[CookieFabric.Reply] = cookieFabric.ask(ref => CookieFabric.GiveMeCookies(3, ref)) @@ -563,7 +563,7 @@ class InteractionPatternsSpec extends ScalaTestWithActorTestKit with AnyWordSpec // the ask is failed with a TimeoutException implicit val timeout: Timeout = 3.seconds // implicit ActorSystem in scope - implicit val system: ActorSystem[_] = theSystem + implicit val system: ActorSystem[?] = theSystem val result: Future[CookieFabric.Cookies] = cookieFabric.askWithStatus(ref => CookieFabric.GiveMeCookies(3, ref)) diff --git a/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/LoggingDocExamples.scala b/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/LoggingDocExamples.scala index f4e62b32794..ea59d532fb5 100644 --- a/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/LoggingDocExamples.scala +++ b/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/LoggingDocExamples.scala @@ -104,7 +104,7 @@ object LoggingDocExamples { } def withMdc(): Unit = { - val system: ActorSystem[_] = ??? + val system: ActorSystem[?] = ??? // #withMdc val staticMdc = Map("startTime" -> system.startTime.toString) @@ -118,7 +118,7 @@ object LoggingDocExamples { } def logging(): Unit = { - implicit val system: ActorSystem[_] = ??? + implicit val system: ActorSystem[?] = ??? final case class Message(s: String) val ref: ActorRef[Message] = ??? diff --git a/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/StyleGuideDocExamples.scala b/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/StyleGuideDocExamples.scala index 5d950775f7d..49d58c530f0 100644 --- a/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/StyleGuideDocExamples.scala +++ b/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/StyleGuideDocExamples.scala @@ -311,7 +311,7 @@ object StyleGuideDocExamples { // #behavior-factory-method object Usage { - val context: ActorContext[_] = ??? + val context: ActorContext[?] = ??? val doneRef: ActorRef[Done] = ??? // #behavior-factory-method-spawn diff --git a/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/extensions/ExtensionDocSpec.scala b/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/extensions/ExtensionDocSpec.scala index d7d6f831e02..7e8b20a20ce 100644 --- a/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/extensions/ExtensionDocSpec.scala +++ b/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/extensions/ExtensionDocSpec.scala @@ -33,16 +33,16 @@ class ExpensiveDatabaseConnection { //#extension-id object DatabasePool extends ExtensionId[DatabasePool] { // will only be called once - def createExtension(system: ActorSystem[_]): DatabasePool = new DatabasePool(system) + def createExtension(system: ActorSystem[?]): DatabasePool = new DatabasePool(system) // Java API - def get(system: ActorSystem[_]): DatabasePool = apply(system) + def get(system: ActorSystem[?]): DatabasePool = apply(system) } //#extension-id @nowarn //#extension -class DatabasePool(system: ActorSystem[_]) extends Extension { +class DatabasePool(system: ActorSystem[?]) extends Extension { // database configuration can be loaded from config // from the actor system private val _connection = new ExpensiveDatabaseConnection() diff --git a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/AskSpec.scala b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/AskSpec.scala index 5dc0dd7697e..4bbd2346883 100644 --- a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/AskSpec.scala +++ b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/AskSpec.scala @@ -107,7 +107,7 @@ class AskSpec extends ScalaTestWithActorTestKit(""" "fail the future if the actor doesn't exist" in { val noSuchActor: ActorRef[Msg] = system match { - case adaptedSys: ActorSystemAdapter[_] => + case adaptedSys: ActorSystemAdapter[?] => import pekko.actor.typed.scaladsl.adapter._ adaptedSys.system.provider.resolveActorRef("/foo/bar") case _ => diff --git a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/ExtensionsSpec.scala b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/ExtensionsSpec.scala index 17bfa5d4ce2..34c77d09c8a 100644 --- a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/ExtensionsSpec.scala +++ b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/ExtensionsSpec.scala @@ -31,17 +31,17 @@ import pekko.actor.typed.scaladsl.Behaviors class DummyExtension1 extends Extension object DummyExtension1 extends ExtensionId[DummyExtension1] { - def createExtension(system: ActorSystem[_]) = new DummyExtension1 - def get(system: ActorSystem[_]): DummyExtension1 = apply(system) + def createExtension(system: ActorSystem[?]) = new DummyExtension1 + def get(system: ActorSystem[?]): DummyExtension1 = apply(system) } -class DummyExtension1Setup(factory: ActorSystem[_] => DummyExtension1) +class DummyExtension1Setup(factory: ActorSystem[?] => DummyExtension1) extends AbstractExtensionSetup[DummyExtension1](DummyExtension1, factory) class DummyExtension1ViaSetup extends DummyExtension1 class SlowExtension extends Extension object SlowExtension extends ExtensionId[SlowExtension] { - def createExtension(system: ActorSystem[_]) = { + def createExtension(system: ActorSystem[?]) = { Thread.sleep(25) new SlowExtension } @@ -49,29 +49,29 @@ object SlowExtension extends ExtensionId[SlowExtension] { class FailingToLoadExtension extends Extension object FailingToLoadExtension extends ExtensionId[FailingToLoadExtension] { - def createExtension(system: ActorSystem[_]) = { + def createExtension(system: ActorSystem[?]) = { throw new RuntimeException("I cannot be trusted!") } } class MultiExtension(val n: Int) extends Extension class MultiExtensionId(n: Int) extends ExtensionId[MultiExtension] { - def createExtension(system: ActorSystem[_]): MultiExtension = new MultiExtension(n) + def createExtension(system: ActorSystem[?]): MultiExtension = new MultiExtension(n) } object InstanceCountingExtension extends ExtensionId[DummyExtension1] { val createCount = new AtomicInteger(0) - override def createExtension(system: ActorSystem[_]): DummyExtension1 = { + override def createExtension(system: ActorSystem[?]): DummyExtension1 = { createCount.addAndGet(1) new DummyExtension1 } } object AccessSystemFromConstructorExtensionId extends ExtensionId[AccessSystemFromConstructor] { - override def createExtension(system: ActorSystem[_]): AccessSystemFromConstructor = + override def createExtension(system: ActorSystem[?]): AccessSystemFromConstructor = new AccessSystemFromConstructor(system) } -class AccessSystemFromConstructor(system: ActorSystem[_]) extends Extension { +class AccessSystemFromConstructor(system: ActorSystem[?]) extends Extension { system.log.info("I log from the constructor") system.receptionist ! Receptionist.Find(ServiceKey[String]("i-just-made-it-up"), system.deadLetters) // or touch the receptionist! } @@ -266,7 +266,7 @@ class ExtensionsSpec extends ScalaTestWithActorTestKit with AnyWordSpecLike with } def withEmptyActorSystem[T](name: String, config: Option[Config] = None, setup: Option[ActorSystemSetup] = None)( - f: ActorSystem[_] => T): T = { + f: ActorSystem[?] => T): T = { val bootstrap = config match { case Some(c) => BootstrapSetup(c) diff --git a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/LocalActorRefProviderLogMessagesSpec.scala b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/LocalActorRefProviderLogMessagesSpec.scala index dd8b9dc05c1..2086e89634f 100644 --- a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/LocalActorRefProviderLogMessagesSpec.scala +++ b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/LocalActorRefProviderLogMessagesSpec.scala @@ -38,7 +38,7 @@ class LocalActorRefProviderLogMessagesSpec "An LocalActorRefProvider" must { "logs on dedicated 'serialization' logger of unknown path" in { - val provider = system.asInstanceOf[ActorSystemAdapter[_]].provider + val provider = system.asInstanceOf[ActorSystemAdapter[?]].provider LoggingTestKit .debug("of unknown (invalid) path [dummy/path]") @@ -49,7 +49,7 @@ class LocalActorRefProviderLogMessagesSpec } "logs on dedicated 'serialization' logger when path doesn't match existing actor" in { - val provider = system.asInstanceOf[ActorSystemAdapter[_]].provider + val provider = system.asInstanceOf[ActorSystemAdapter[?]].provider val invalidPath = provider.rootPath / "user" / "invalid" LoggingTestKit @@ -62,10 +62,10 @@ class LocalActorRefProviderLogMessagesSpec "logs on dedicated 'serialization' logger when of foreign path" in { - val otherSystem = ActorTestKit("otherSystem").system.asInstanceOf[ActorSystemAdapter[_]] + val otherSystem = ActorTestKit("otherSystem").system.asInstanceOf[ActorSystemAdapter[?]] val invalidPath = otherSystem.provider.rootPath / "user" / "foo" - val provider = system.asInstanceOf[ActorSystemAdapter[_]].provider + val provider = system.asInstanceOf[ActorSystemAdapter[?]].provider try { LoggingTestKit .debug("Resolve (deserialization) of foreign path [pekko://otherSystem/user/foo]") diff --git a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/MailboxSelectorSpec.scala b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/MailboxSelectorSpec.scala index e90eab5909b..93fa97fdd62 100644 --- a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/MailboxSelectorSpec.scala +++ b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/MailboxSelectorSpec.scala @@ -44,7 +44,7 @@ class MailboxSelectorSpec extends ScalaTestWithActorTestKit(""" Behaviors.receiveMessage[WhatsYourMailbox] { case WhatsYourMailbox(replyTo) => val mailbox = context match { - case adapter: ActorContextAdapter[_] => + case adapter: ActorContextAdapter[?] => adapter.classicContext match { case cell: ActorCell => cell.mailbox.messageQueue diff --git a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/SupervisionSpec.scala b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/SupervisionSpec.scala index f6288791f7e..9ee53be5421 100644 --- a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/SupervisionSpec.scala +++ b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/SupervisionSpec.scala @@ -49,8 +49,8 @@ object SupervisionSpec { case object IncrementState extends Command case object GetState extends Command final case class CreateChild[T](behavior: Behavior[T], name: String) extends Command - final case class Watch(ref: ActorRef[_]) extends Command - final case class WatchWith(ref: ActorRef[_], cmd: Command) extends Command + final case class Watch(ref: ActorRef[?]) extends Command + final case class WatchWith(ref: ActorRef[?], cmd: Command) extends Command sealed trait Event final case class Pong(n: Int) extends Event @@ -1408,7 +1408,7 @@ class SupervisionSpec extends ScalaTestWithActorTestKit(""" LoggingTestKit.error[DeathPactException].expect { actor ! "boom" - val child = probe.expectMessageType[ActorRef[_]] + val child = probe.expectMessageType[ActorRef[?]] probe.expectTerminated(child, 3.seconds) } actor ! "ping" diff --git a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/delivery/DurableProducerControllerSpec.scala b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/delivery/DurableProducerControllerSpec.scala index 9c8a2047e88..ce18db7f2e1 100644 --- a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/delivery/DurableProducerControllerSpec.scala +++ b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/delivery/DurableProducerControllerSpec.scala @@ -97,7 +97,7 @@ class DurableProducerControllerSpec val durable = TestDurableProducerQueue[TestConsumer.Job]( Duration.Zero, stateHolder, - (_: DurableProducerQueue.Command[_]) => false) + (_: DurableProducerQueue.Command[?]) => false) val producerController = spawn(ProducerController[TestConsumer.Job](producerId, Some(durable)), s"producerController-$idCount") @@ -182,7 +182,7 @@ class DurableProducerControllerSpec TestDurableProducerQueue[TestConsumer.Job]( Duration.Zero, stateHolder, - (_: DurableProducerQueue.Command[_]) => false) + (_: DurableProducerQueue.Command[?]) => false) val producerController = spawn( diff --git a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/delivery/DurableWorkPullingSpec.scala b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/delivery/DurableWorkPullingSpec.scala index 617e27c9f1e..db3b1ac4056 100644 --- a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/delivery/DurableWorkPullingSpec.scala +++ b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/delivery/DurableWorkPullingSpec.scala @@ -167,7 +167,7 @@ class DurableWorkPullingSpec val durable = TestDurableProducerQueue[TestConsumer.Job]( Duration.Zero, stateHolder, - (_: DurableProducerQueue.Command[_]) => false) + (_: DurableProducerQueue.Command[?]) => false) val workPullingController = spawn( @@ -289,7 +289,7 @@ class DurableWorkPullingSpec val durable = TestDurableProducerQueue[TestConsumer.Job]( Duration.Zero, stateHolder, - (_: DurableProducerQueue.Command[_]) => false) + (_: DurableProducerQueue.Command[?]) => false) val workPullingController = spawn( diff --git a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/delivery/ReliableDeliveryRandomSpec.scala b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/delivery/ReliableDeliveryRandomSpec.scala index 99ec8e49c93..c50357cc763 100644 --- a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/delivery/ReliableDeliveryRandomSpec.scala +++ b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/delivery/ReliableDeliveryRandomSpec.scala @@ -105,7 +105,7 @@ class ReliableDeliveryRandomSpec(config: Config) // RandomFlakyNetwork to simulate lost messages from producerController to consumerController val consumerDrop: Any => Double = { - case _: ConsumerController.SequencedMessage[_] => consumerDropProbability + case _: ConsumerController.SequencedMessage[?] => consumerDropProbability case _ => 0.0 } @@ -123,7 +123,7 @@ class ReliableDeliveryRandomSpec(config: Config) val producerDrop: Any => Double = { case _: ProducerControllerImpl.Request => producerDropProbability case _: ProducerControllerImpl.Resend => producerDropProbability - case _: ProducerController.RegisterConsumer[_] => producerDropProbability + case _: ProducerController.RegisterConsumer[?] => producerDropProbability case _ => 0.0 } diff --git a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/internal/ActorSystemSpec.scala b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/internal/ActorSystemSpec.scala index 38a181640db..53f79c7b455 100644 --- a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/internal/ActorSystemSpec.scala +++ b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/internal/ActorSystemSpec.scala @@ -192,7 +192,7 @@ class ActorSystemSpec Behaviors.receive[WhatsYourMailbox] { case (context, WhatsYourMailbox(replyTo)) => replyTo ! context - .asInstanceOf[ActorContextImpl[_]] + .asInstanceOf[ActorContextImpl[?]] .classicActorContext .asInstanceOf[Dispatch] .mailbox diff --git a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/internal/receptionist/LocalReceptionistSpec.scala b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/internal/receptionist/LocalReceptionistSpec.scala index d463f23c44c..b2ea46d2e21 100644 --- a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/internal/receptionist/LocalReceptionistSpec.scala +++ b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/internal/receptionist/LocalReceptionistSpec.scala @@ -208,7 +208,7 @@ class LocalReceptionistSpec extends ScalaTestWithActorTestKit with AnyWordSpecLi class LocalReceptionistBehaviorSpec extends AnyWordSpec with Matchers with LogCapturing { import LocalReceptionistSpec._ - def assertEmpty(inboxes: TestInbox[_]*): Unit = { + def assertEmpty(inboxes: TestInbox[?]*): Unit = { inboxes.foreach(i => withClue(s"inbox $i had messages")(i.hasMessages should be(false))) } diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/ActorRef.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/ActorRef.scala index b25f0560186..3d369223b90 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/ActorRef.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/ActorRef.scala @@ -32,7 +32,7 @@ import pekko.annotation.DoNotInherit * Not for user extension */ @DoNotInherit -trait ActorRef[-T] extends RecipientRef[T] with java.lang.Comparable[ActorRef[_]] with java.io.Serializable { +trait ActorRef[-T] extends RecipientRef[T] with java.lang.Comparable[ActorRef[?]] with java.io.Serializable { this: InternalRecipientRef[T] => /** diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/ActorRefResolver.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/ActorRefResolver.scala index aa9769d3439..ffa931d9387 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/ActorRefResolver.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/ActorRefResolver.scala @@ -18,9 +18,9 @@ import pekko.actor.{ ActorRefWithCell, ExtendedActorSystem } import pekko.annotation.{ DoNotInherit, InternalApi } object ActorRefResolver extends ExtensionId[ActorRefResolver] { - def get(system: ActorSystem[_]): ActorRefResolver = apply(system) + def get(system: ActorSystem[?]): ActorRefResolver = apply(system) - override def createExtension(system: ActorSystem[_]): ActorRefResolver = + override def createExtension(system: ActorSystem[?]): ActorRefResolver = new ActorRefResolverImpl(system) } @@ -53,7 +53,7 @@ abstract class ActorRefResolver extends Extension { /** * INTERNAL API */ -@InternalApi private[pekko] class ActorRefResolverImpl(system: ActorSystem[_]) extends ActorRefResolver { +@InternalApi private[pekko] class ActorRefResolverImpl(system: ActorSystem[?]) extends ActorRefResolver { import pekko.actor.typed.scaladsl.adapter._ private val classicSystem = system.toClassic.asInstanceOf[ExtendedActorSystem] @@ -93,7 +93,7 @@ abstract class ActorRefResolver extends Extension { } object ActorRefResolverSetup { - def apply[T <: Extension](createExtension: ActorSystem[_] => ActorRefResolver): ActorRefResolverSetup = + def apply[T <: Extension](createExtension: ActorSystem[?] => ActorRefResolver): ActorRefResolverSetup = new ActorRefResolverSetup(sys => createExtension(sys)) } @@ -103,5 +103,5 @@ object ActorRefResolverSetup { * to replace the default implementation of the [[ActorRefResolver]] extension. Intended * for tests that need to replace extension with stub/mock implementations. */ -final class ActorRefResolverSetup(createExtension: java.util.function.Function[ActorSystem[_], ActorRefResolver]) +final class ActorRefResolverSetup(createExtension: java.util.function.Function[ActorSystem[?], ActorRefResolver]) extends ExtensionSetup[ActorRefResolver](ActorRefResolver, createExtension) diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/BehaviorInterceptor.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/BehaviorInterceptor.scala index b25a24a50aa..421b2a11fec 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/BehaviorInterceptor.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/BehaviorInterceptor.scala @@ -102,7 +102,7 @@ object BehaviorInterceptor { */ @DoNotInherit trait PreStartTarget[T] { - def start(ctx: TypedActorContext[_]): Behavior[T] + def start(ctx: TypedActorContext[?]): Behavior[T] } /** @@ -112,7 +112,7 @@ object BehaviorInterceptor { */ @DoNotInherit trait ReceiveTarget[T] { - def apply(ctx: TypedActorContext[_], msg: T): Behavior[T] + def apply(ctx: TypedActorContext[?], msg: T): Behavior[T] /** * INTERNAL API @@ -123,7 +123,7 @@ object BehaviorInterceptor { * is taking place. */ @InternalApi - private[pekko] def signalRestart(ctx: TypedActorContext[_]): Unit + private[pekko] def signalRestart(ctx: TypedActorContext[?]): Unit } /** @@ -133,7 +133,7 @@ object BehaviorInterceptor { */ @DoNotInherit trait SignalTarget[T] { - def apply(ctx: TypedActorContext[_], signal: Signal): Behavior[T] + def apply(ctx: TypedActorContext[?], signal: Signal): Behavior[T] } } diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/Extensions.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/Extensions.scala index e1cfa9e880b..92a6c112e9f 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/Extensions.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/Extensions.scala @@ -120,12 +120,12 @@ abstract class ExtensionId[T <: Extension] { /** * Create the extension, will be invoked at most one time per actor system where the extension is registered. */ - def createExtension(system: ActorSystem[_]): T + def createExtension(system: ActorSystem[?]): T /** * Lookup or create an instance of the extension identified by this id. */ - final def apply(system: ActorSystem[_]): T = system.registerExtension(this) + final def apply(system: ActorSystem[?]): T = system.registerExtension(this) override final def hashCode: Int = System.identityHashCode(this) override final def equals(other: Any): Boolean = this eq other.asInstanceOf[AnyRef] @@ -163,7 +163,7 @@ trait Extensions { * Returns whether the specified extension is already registered, this method can potentially block, waiting for the initialization * of the payload, if is in the process of registration from another Thread of execution */ - def hasExtension(ext: ExtensionId[_ <: Extension]): Boolean + def hasExtension(ext: ExtensionId[? <: Extension]): Boolean } /** @@ -174,7 +174,7 @@ trait Extensions { */ abstract class ExtensionSetup[T <: Extension]( val extId: ExtensionId[T], - val createExtension: java.util.function.Function[ActorSystem[_], T]) + val createExtension: java.util.function.Function[ActorSystem[?], T]) extends Setup /** @@ -183,5 +183,5 @@ abstract class ExtensionSetup[T <: Extension]( * implementation of the extension. Intended for tests that need to replace * extension with stub/mock implementations. */ -abstract class AbstractExtensionSetup[T <: Extension](extId: ExtensionId[T], createExtension: ActorSystem[_] => T) +abstract class AbstractExtensionSetup[T <: Extension](extId: ExtensionId[T], createExtension: ActorSystem[?] => T) extends ExtensionSetup[T](extId, createExtension.apply) diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/ConsumerController.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/ConsumerController.scala index 3ff6e20801b..e09feab6831 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/ConsumerController.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/ConsumerController.scala @@ -204,7 +204,7 @@ object ConsumerController { * Scala API: Factory method from config `pekko.reliable-delivery.consumer-controller` * of the `ActorSystem`. */ - def apply(system: ActorSystem[_]): Settings = + def apply(system: ActorSystem[?]): Settings = apply(system.settings.config.getConfig("pekko.reliable-delivery.consumer-controller")) /** @@ -223,7 +223,7 @@ object ConsumerController { * Java API: Factory method from config `pekko.reliable-delivery.producer-controller` * of the `ActorSystem`. */ - def create(system: ActorSystem[_]): Settings = + def create(system: ActorSystem[?]): Settings = apply(system) /** diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/DurableProducerQueue.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/DurableProducerQueue.scala index 713b52e282e..db2c3cf3210 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/DurableProducerQueue.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/DurableProducerQueue.scala @@ -173,7 +173,7 @@ object DurableProducerQueue { override def equals(obj: Any): Boolean = { obj match { - case other: MessageSent[_] => + case other: MessageSent[?] => seqNr == other.seqNr && message == other.message && ack == other.ack && confirmationQualifier == other.confirmationQualifier && timestampMillis == other.timestampMillis case _ => false } @@ -224,7 +224,7 @@ object DurableProducerQueue { new MessageSent(seqNr, message, ack, confirmationQualifier, timestampMillis) def unapply( - sent: MessageSent[_]): Option[(SeqNr, MessageOrChunk, Boolean, ConfirmationQualifier, TimestampMillis)] = + sent: MessageSent[?]): Option[(SeqNr, MessageOrChunk, Boolean, ConfirmationQualifier, TimestampMillis)] = Some((sent.seqNr, sent.message, sent.ack, sent.confirmationQualifier, sent.timestampMillis)) } diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/ProducerController.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/ProducerController.scala index 252f06fa077..3410eeb6105 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/ProducerController.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/ProducerController.scala @@ -157,7 +157,7 @@ object ProducerController { * Scala API: Factory method from config `pekko.reliable-delivery.producer-controller` * of the `ActorSystem`. */ - def apply(system: ActorSystem[_]): Settings = + def apply(system: ActorSystem[?]): Settings = apply(system.settings.config.getConfig("pekko.reliable-delivery.producer-controller")) /** @@ -181,7 +181,7 @@ object ProducerController { * Java API: Factory method from config `pekko.reliable-delivery.producer-controller` * of the `ActorSystem`. */ - def create(system: ActorSystem[_]): Settings = + def create(system: ActorSystem[?]): Settings = apply(system) /** diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/WorkPullingProducerController.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/WorkPullingProducerController.scala index bbe094f3c21..f9c7db9c94f 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/WorkPullingProducerController.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/WorkPullingProducerController.scala @@ -154,7 +154,7 @@ object WorkPullingProducerController { * Scala API: Factory method from config `pekko.reliable-delivery.work-pulling.producer-controller` * of the `ActorSystem`. */ - def apply(system: ActorSystem[_]): Settings = + def apply(system: ActorSystem[?]): Settings = apply(system.settings.config.getConfig("pekko.reliable-delivery.work-pulling.producer-controller")) /** @@ -172,7 +172,7 @@ object WorkPullingProducerController { * Java API: Factory method from config `pekko.reliable-delivery.work-pulling.producer-controller` * of the `ActorSystem`. */ - def create(system: ActorSystem[_]): Settings = + def create(system: ActorSystem[?]): Settings = apply(system) /** diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/internal/ConsumerControllerImpl.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/internal/ConsumerControllerImpl.scala index 0467cb1aab0..e6da14dba34 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/internal/ConsumerControllerImpl.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/internal/ConsumerControllerImpl.scala @@ -89,7 +89,7 @@ import pekko.util.ConstantFun.scalaIdentityFunction private case object Retry extends InternalCommand - private final case class ConsumerTerminated(consumer: ActorRef[_]) extends InternalCommand + private final case class ConsumerTerminated(consumer: ActorRef[?]) extends InternalCommand private final case class State[A]( producerController: ActorRef[ProducerControllerImpl.InternalCommand], @@ -170,7 +170,7 @@ import pekko.util.ConstantFun.scalaIdentityFunction } Behaviors.same - case _: DeliverThenStop[_] => + case _: DeliverThenStop[?] => if (stashBuffer.isEmpty) { Behaviors.stopped } else { @@ -203,7 +203,7 @@ import pekko.util.ConstantFun.scalaIdentityFunction private def mdcForMessage(msg: InternalCommand): Map[String, String] = { msg match { - case seqMsg: SequencedMessage[_] => Map("producerId" -> seqMsg.producerId) + case seqMsg: SequencedMessage[?] => Map("producerId" -> seqMsg.producerId) case _ => Map.empty } } @@ -225,7 +225,7 @@ import pekko.util.ConstantFun.scalaIdentityFunction stopping) } - def enforceLocalConsumer(ref: ActorRef[_]): Unit = { + def enforceLocalConsumer(ref: ActorRef[?]): Unit = { if (ref.path.address.hasGlobalScope) throw new IllegalArgumentException(s"Consumer [$ref] should be local.") } @@ -359,7 +359,7 @@ private class ConsumerControllerImpl[A] private ( case reg: RegisterToProducerController[A @unchecked] => receiveRegisterToProducerController(s, reg, newState => active(newState)) - case _: DeliverThenStop[_] => + case _: DeliverThenStop[?] => receiveDeliverThenStop(s, newState => active(newState)) case _: UnsealedInternalCommand => @@ -484,7 +484,7 @@ private class ConsumerControllerImpl[A] private ( case reg: RegisterToProducerController[A @unchecked] => receiveRegisterToProducerController(s, reg, newState => active(newState)) - case _: DeliverThenStop[_] => + case _: DeliverThenStop[?] => receiveDeliverThenStop(s, newState => resending(newState)) case _: UnsealedInternalCommand => @@ -604,7 +604,7 @@ private class ConsumerControllerImpl[A] private ( scalaIdentityFunction) } - case msg: SequencedMessage[_] => + case msg: SequencedMessage[?] => flightRecorder.consumerReceivedPreviousInProgress(msg.producerId, msg.seqNr, stashBuffer.size + 1) val expectedSeqNr = seqMsg.seqNr + stashBuffer.size + 1 if (msg.seqNr < expectedSeqNr && msg.producerController == seqMsg.producerController) { @@ -642,7 +642,7 @@ private class ConsumerControllerImpl[A] private ( case reg: RegisterToProducerController[A @unchecked] => receiveRegisterToProducerController(s, reg, newState => waitingForConfirmation(newState, seqMsg)) - case _: DeliverThenStop[_] => + case _: DeliverThenStop[?] => receiveDeliverThenStop(s, newState => waitingForConfirmation(newState, seqMsg)) case _: UnsealedInternalCommand => @@ -708,7 +708,7 @@ private class ConsumerControllerImpl[A] private ( } } - private def receiveConsumerTerminated(c: ActorRef[_]): Behavior[InternalCommand] = { + private def receiveConsumerTerminated(c: ActorRef[?]): Behavior[InternalCommand] = { context.log.debug("Consumer [{}] terminated.", c) Behaviors.stopped } diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/internal/ProducerControllerImpl.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/internal/ProducerControllerImpl.scala index 6358740f159..78c25f1291b 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/internal/ProducerControllerImpl.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/internal/ProducerControllerImpl.scala @@ -342,7 +342,7 @@ object ProducerControllerImpl { } } - def enforceLocalProducer(ref: ActorRef[_]): Unit = { + def enforceLocalProducer(ref: ActorRef[?]): Unit = { if (ref.path.address.hasGlobalScope) throw new IllegalArgumentException(s"Consumer [$ref] should be local.") } @@ -803,7 +803,7 @@ private class ProducerControllerImpl[A: ClassTag]( active(s.copy(remainingChunks = chunks, storeMessageSentInProgress = seqMsg.seqNr)) } - case StoreMessageSentCompleted(sent: MessageSent[_]) => + case StoreMessageSentCompleted(sent: MessageSent[?]) => receiveStoreMessageSentCompleted(sent.seqNr) case f: StoreMessageSentFailed[A @unchecked] => diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/eventstream/EventStream.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/eventstream/EventStream.scala index 9b39cfd1b9d..a37d2120ada 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/eventstream/EventStream.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/eventstream/EventStream.scala @@ -63,7 +63,7 @@ object EventStream { /** * INTERNAL API */ - @InternalApi private[pekko] def topic: Class[_] = classTag.runtimeClass + @InternalApi private[pekko] def topic: Class[?] = classTag.runtimeClass } /** diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/ActorContextImpl.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/ActorContextImpl.scala index 6d6864246a4..883cd77f143 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/ActorContextImpl.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/ActorContextImpl.scala @@ -46,7 +46,7 @@ import scala.util.Success // single context for logging as there are a few things that are initialized // together that we can cache as long as the actor is alive object LoggingContext { - def apply(logger: Logger, tags: Set[String], ctx: ActorContextImpl[_]): LoggingContext = { + def apply(logger: Logger, tags: Set[String], ctx: ActorContextImpl[?]): LoggingContext = { val tagsString = // "" means no tags if (tags.isEmpty) "" @@ -59,7 +59,7 @@ import scala.util.Success val pekkoAddress = ctx.system match { - case adapter: ActorSystemAdapter[_] => adapter.provider.addressString + case adapter: ActorSystemAdapter[?] => adapter.provider.addressString case _ => Address("pekko", ctx.system.name).toString } @@ -103,7 +103,7 @@ import scala.util.Success private var _logging: OptionVal[LoggingContext] = OptionVal.None private var messageAdapterRef: OptionVal[ActorRef[Any]] = OptionVal.None - private var _messageAdapters: List[(Class[_], Any => T)] = Nil + private var _messageAdapters: List[(Class[?], Any => T)] = Nil private var _timer: OptionVal[TimerSchedulerCrossDslSupport[T]] = OptionVal.None // _currentActorThread is on purpose not volatile. Used from `checkCurrentActorThread`. @@ -162,7 +162,7 @@ import scala.util.Success _logging match { case OptionVal.Some(l) => l case _ => - val logClass = LoggerClass.detectLoggerClassFromStack(classOf[Behavior[_]]) + val logClass = LoggerClass.detectLoggerClassFromStack(classOf[Behavior[?]]) val logger = LoggerFactory.getLogger(logClass.getName) val l = LoggingContext(logger, classicActorContext.props.deploy.tags, this) _logging = OptionVal.Some(l) @@ -184,7 +184,7 @@ import scala.util.Success _logging = OptionVal.Some(loggingContext().withLogger(LoggerFactory.getLogger(name))) } - override def setLoggerName(clazz: Class[_]): Unit = + override def setLoggerName(clazz: Class[?]): Unit = setLoggerName(clazz.getName) def hasCustomLoggerName: Boolean = loggingContext().hasCustomName @@ -236,7 +236,7 @@ import scala.util.Success ask(target, createRequest) { case Success(StatusReply.Success(t: Res)) => mapResponse(Success(t)) case Success(StatusReply.Error(why)) => mapResponse(Failure(why)) - case fail: Failure[_] => mapResponse(fail.asInstanceOf[Failure[Res]]) + case fail: Failure[?] => mapResponse(fail.asInstanceOf[Failure[Res]]) case _ => throw new RuntimeException() // won't happen, compiler exhaustiveness check pleaser } @@ -333,7 +333,7 @@ import scala.util.Success /** * INTERNAL API */ - @InternalApi private[pekko] def messageAdapters: List[(Class[_], Any => T)] = _messageAdapters + @InternalApi private[pekko] def messageAdapters: List[(Class[?], Any => T)] = _messageAdapters /** * INTERNAL API diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/ActorFlightRecorder.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/ActorFlightRecorder.scala index 163650e3bfa..5b093a96533 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/ActorFlightRecorder.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/ActorFlightRecorder.scala @@ -25,7 +25,7 @@ import pekko.util.FlightRecorderLoader @InternalApi object ActorFlightRecorder extends ExtensionId[ActorFlightRecorder] { - override def createExtension(system: ActorSystem[_]): ActorFlightRecorder = + override def createExtension(system: ActorSystem[?]): ActorFlightRecorder = FlightRecorderLoader.load[ActorFlightRecorder]( system, "org.apache.pekko.actor.typed.internal.jfr.JFRActorFlightRecorder", diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/ActorRefImpl.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/ActorRefImpl.scala index 33dd5ae1deb..89a3772c773 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/ActorRefImpl.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/ActorRefImpl.scala @@ -33,7 +33,7 @@ private[pekko] trait ActorRefImpl[-T] extends ActorRef[T] { this: InternalRecipi /** * Comparison takes path and the unique id of the actor cell into account. */ - final override def compareTo(other: ActorRef[_]) = { + final override def compareTo(other: ActorRef[?]) = { val x = this.path.compareTo(other.path) if (x == 0) if (this.path.uid < other.path.uid) -1 else if (this.path.uid == other.path.uid) 0 else 1 else x @@ -45,7 +45,7 @@ private[pekko] trait ActorRefImpl[-T] extends ActorRef[T] { this: InternalRecipi * Equals takes path and the unique id of the actor cell into account. */ final override def equals(that: Any): Boolean = that match { - case other: ActorRef[_] => path.uid == other.path.uid && path == other.path + case other: ActorRef[?] => path.uid == other.path.uid && path == other.path case _ => false } diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/EventStreamExtension.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/EventStreamExtension.scala index 059f8576636..899b9514654 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/EventStreamExtension.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/EventStreamExtension.scala @@ -27,11 +27,11 @@ import pekko.annotation.InternalApi * * It is used as an extension to ensure a single instance per actor system. */ -@InternalApi private[pekko] final class EventStreamExtension(actorSystem: ActorSystem[_]) extends Extension { +@InternalApi private[pekko] final class EventStreamExtension(actorSystem: ActorSystem[?]) extends Extension { val ref: ActorRef[EventStream.Command] = actorSystem.internalSystemActorOf(EventStreamAdapter.behavior, "eventstream", Props.empty) } private[pekko] object EventStreamExtension extends ExtensionId[EventStreamExtension] { - override def createExtension(system: ActorSystem[_]): EventStreamExtension = new EventStreamExtension(system) + override def createExtension(system: ActorSystem[?]): EventStreamExtension = new EventStreamExtension(system) } diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/ExtensionsImpl.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/ExtensionsImpl.scala index 09854cd264b..f7cf76d6320 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/ExtensionsImpl.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/ExtensionsImpl.scala @@ -30,9 +30,9 @@ import pekko.util.ccompat.JavaConverters._ * Actor system extensions registry */ @InternalApi -private[pekko] trait ExtensionsImpl extends Extensions { self: ActorSystem[_] with InternalRecipientRef[_] => +private[pekko] trait ExtensionsImpl extends Extensions { self: ActorSystem[?] with InternalRecipientRef[?] => - private val extensions = new ConcurrentHashMap[ExtensionId[_], AnyRef] + private val extensions = new ConcurrentHashMap[ExtensionId[?], AnyRef] /** * Hook for ActorSystem to load extensions on startup @@ -51,7 +51,7 @@ private[pekko] trait ExtensionsImpl extends Extensions { self: ActorSystem[_] wi } idTry match { - case Success(id: ExtensionId[_]) => registerExtension(id) + case Success(id: ExtensionId[?]) => registerExtension(id) case Success(_) => if (!throwOnLoadFail) log.error("[{}] is not an 'ExtensionId', skipping...", extensionIdFQCN) else throw new RuntimeException(s"[$extensionIdFQCN] is not an 'ExtensionId'") @@ -65,7 +65,7 @@ private[pekko] trait ExtensionsImpl extends Extensions { self: ActorSystem[_] wi def idFromJavaSingletonAccessor(extensionIdFQCN: String): Try[ExtensionId[Extension]] = dynamicAccess.getClassFor[ExtensionId[Extension]](extensionIdFQCN).flatMap[ExtensionId[Extension]] { - (clazz: Class[_]) => + (clazz: Class[?]) => Try { val singletonAccessor = clazz.getDeclaredMethod("getInstance") singletonAccessor.invoke(null).asInstanceOf[ExtensionId[Extension]] @@ -76,7 +76,7 @@ private[pekko] trait ExtensionsImpl extends Extensions { self: ActorSystem[_] wi loadExtensionsFor("pekko.actor.typed.extensions", throwOnLoadFail = false) } - final override def hasExtension(ext: ExtensionId[_ <: Extension]): Boolean = findExtension(ext) != null + final override def hasExtension(ext: ExtensionId[? <: Extension]): Boolean = findExtension(ext) != null final override def extension[T <: Extension](ext: ExtensionId[T]): T = findExtension(ext) match { case null => throw new IllegalArgumentException(s"Trying to get non-registered extension [$ext]") @@ -97,7 +97,7 @@ private[pekko] trait ExtensionsImpl extends Extensions { self: ActorSystem[_] wi // Create and initialize the extension, first look for ExtensionSetup val instance = self.settings.setup.setups .collectFirst { - case (_, extSetup: ExtensionSetup[_]) if extSetup.extId == ext => extSetup.createExtension(self) + case (_, extSetup: ExtensionSetup[?]) if extSetup.extId == ext => extSetup.createExtension(self) } .getOrElse(ext.createExtension(self)) instance match { diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/InterceptorImpl.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/InterceptorImpl.scala index 0763b224873..b6b6ff25b30 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/InterceptorImpl.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/InterceptorImpl.scala @@ -56,24 +56,24 @@ private[pekko] final class InterceptorImpl[O, I]( import BehaviorInterceptor._ private val preStartTarget: PreStartTarget[I] = new PreStartTarget[I] { - override def start(ctx: TypedActorContext[_]): Behavior[I] = { + override def start(ctx: TypedActorContext[?]): Behavior[I] = { Behavior.start[I](nestedBehavior, ctx.asInstanceOf[TypedActorContext[I]]) } override def toString: String = s"PreStartTarget($nestedBehavior)" } private val receiveTarget: ReceiveTarget[I] = new ReceiveTarget[I] { - override def apply(ctx: TypedActorContext[_], msg: I): Behavior[I] = + override def apply(ctx: TypedActorContext[?], msg: I): Behavior[I] = Behavior.interpretMessage(nestedBehavior, ctx.asInstanceOf[TypedActorContext[I]], msg) - override def signalRestart(ctx: TypedActorContext[_]): Unit = + override def signalRestart(ctx: TypedActorContext[?]): Unit = Behavior.interpretSignal(nestedBehavior, ctx.asInstanceOf[TypedActorContext[I]], PreRestart) override def toString: String = s"ReceiveTarget($nestedBehavior)" } private val signalTarget = new SignalTarget[I] { - override def apply(ctx: TypedActorContext[_], signal: Signal): Behavior[I] = + override def apply(ctx: TypedActorContext[?], signal: Signal): Behavior[I] = Behavior.interpretSignal(nestedBehavior, ctx.asInstanceOf[TypedActorContext[I]], signal) override def toString: String = s"SignalTarget($nestedBehavior)" } @@ -111,7 +111,7 @@ private[pekko] final class InterceptorImpl[O, I]( } else { // returned behavior could be nested in setups, so we need to start before we deduplicate val duplicateInterceptExists = Behavior.existsInStack(started) { - case i: InterceptorImpl[_, _] + case i: InterceptorImpl[?, ?] if interceptor.isSame(i.interceptor.asInstanceOf[BehaviorInterceptor[Any, Any]]) => true case _ => false diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/LoggerClass.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/LoggerClass.scala index 6fd02e35604..5d937a9189f 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/LoggerClass.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/LoggerClass.scala @@ -27,7 +27,7 @@ private[pekko] object LoggerClass { // just to get access to the class context private final class TrickySecurityManager extends SecurityManager { - def getClassStack: Array[Class[_]] = getClassContext + def getClassStack: Array[Class[?]] = getClassContext } private val defaultPrefixesToSkip = List("scala.runtime", "org.apache.pekko.actor.typed.internal") @@ -35,7 +35,7 @@ private[pekko] object LoggerClass { /** * Try to extract a logger class from the call stack, if not possible the provided default is used */ - def detectLoggerClassFromStack(default: Class[_], additionalPrefixesToSkip: List[String] = Nil): Class[_] = { + def detectLoggerClassFromStack(default: Class[?], additionalPrefixesToSkip: List[String] = Nil): Class[?] = { // TODO use stack walker API when we no longer need to support Java 8 try { def skip(name: String): Boolean = { @@ -50,7 +50,7 @@ private[pekko] object LoggerClass { } val trace = new TrickySecurityManager().getClassStack - var suitableClass: OptionVal[Class[_]] = OptionVal.None + var suitableClass: OptionVal[Class[?]] = OptionVal.None var idx = 1 // skip this method/class and right away while (suitableClass.isEmpty && idx < trace.length) { val clazz = trace(idx) diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/MiscMessageSerializer.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/MiscMessageSerializer.scala index 839ccde3670..aa08d40195e 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/MiscMessageSerializer.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/MiscMessageSerializer.scala @@ -34,13 +34,13 @@ import pekko.serialization.{ BaseSerializer, SerializerWithStringManifest } private val ActorRefManifest = "a" def manifest(o: AnyRef): String = o match { - case _: ActorRef[_] => ActorRefManifest + case _: ActorRef[?] => ActorRefManifest case _ => throw new IllegalArgumentException(s"Can't serialize object of type ${o.getClass} in [${getClass.getName}]") } def toBinary(o: AnyRef): Array[Byte] = o match { - case ref: ActorRef[_] => resolver.toSerializationFormat(ref).getBytes(StandardCharsets.UTF_8) + case ref: ActorRef[?] => resolver.toSerializationFormat(ref).getBytes(StandardCharsets.UTF_8) case _ => throw new IllegalArgumentException(s"Cannot serialize object of type [${o.getClass.getName}]") } diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/PoisonPill.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/PoisonPill.scala index 66a74f76add..76372e913e3 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/PoisonPill.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/PoisonPill.scala @@ -61,5 +61,5 @@ import pekko.annotation.InternalApi override def isSame(other: BehaviorInterceptor[Any, Any]): Boolean = // only one interceptor per behavior stack is needed - other.isInstanceOf[PoisonPillInterceptor[_]] + other.isInstanceOf[PoisonPillInterceptor[?]] } 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 bbc4366cb26..ff08780e54d 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 @@ -43,8 +43,8 @@ import scala.util.Try */ @InternalApi private[pekko] object Supervisor { def apply[T, Thr <: Throwable: ClassTag](initialBehavior: Behavior[T], strategy: SupervisorStrategy): Behavior[T] = { - if (initialBehavior.isInstanceOf[scaladsl.AbstractBehavior[_]] || initialBehavior - .isInstanceOf[javadsl.AbstractBehavior[_]]) { + if (initialBehavior.isInstanceOf[scaladsl.AbstractBehavior[?]] || initialBehavior + .isInstanceOf[javadsl.AbstractBehavior[?]]) { throw new IllegalArgumentException( "The supervised Behavior must not be a AbstractBehavior instance directly," + "because a different instance should be created when it is restarted. Wrap in Behaviors.setup.") @@ -77,7 +77,7 @@ private abstract class AbstractSupervisor[I, Thr <: Throwable](strategy: Supervi override def isSame(other: BehaviorInterceptor[Any, Any]): Boolean = { other match { - case as: AbstractSupervisor[_, _] if throwableClass == as.throwableClass => true + case as: AbstractSupervisor[?, ?] if throwableClass == as.throwableClass => true case _ => false } } @@ -94,10 +94,10 @@ private abstract class AbstractSupervisor[I, Thr <: Throwable](strategy: Supervi } catch handleSignalException(ctx, target) } - def log(ctx: TypedActorContext[_], t: Throwable): Unit = + def log(ctx: TypedActorContext[?], t: Throwable): Unit = log(ctx, t, errorCount = -1) - def log(ctx: TypedActorContext[_], t: Throwable, errorCount: Int): Unit = { + def log(ctx: TypedActorContext[?], t: Throwable, errorCount: Int): Unit = { if (strategy.loggingEnabled) { val unwrapped = UnstashException.unwrap(t) val errorCountStr = if (errorCount >= 0) s" [$errorCount]" else "" @@ -117,7 +117,7 @@ private abstract class AbstractSupervisor[I, Thr <: Throwable](strategy: Supervi } } - def dropped(ctx: TypedActorContext[_], signalOrMessage: Any): Unit = { + def dropped(ctx: TypedActorContext[?], signalOrMessage: Any): Unit = { import pekko.actor.typed.scaladsl.adapter._ ctx.asScala.system.toClassic.eventStream .publish(Dropped(signalOrMessage, s"Stash is full in [${getClass.getSimpleName}]", ctx.asScala.self.toClassic)) @@ -195,10 +195,10 @@ private object RestartSupervisor { } } - final case class ScheduledRestart(owner: RestartSupervisor[_, _ <: Throwable]) + final case class ScheduledRestart(owner: RestartSupervisor[?, ? <: Throwable]) extends Signal with DeadLetterSuppression - final case class ResetRestartCount(current: Int, owner: RestartSupervisor[_, _ <: Throwable]) + final case class ResetRestartCount(current: Int, owner: RestartSupervisor[?, ? <: Throwable]) extends Signal with DeadLetterSuppression } @@ -418,7 +418,7 @@ private class RestartSupervisor[T, Thr <: Throwable: ClassTag](initial: Behavior }) } - private def stopChildren(ctx: TypedActorContext[_], children: Set[ActorRef[Nothing]]): Unit = { + private def stopChildren(ctx: TypedActorContext[?], children: Set[ActorRef[Nothing]]): Unit = { children.foreach { child => // Unwatch in case the actor being restarted used watchWith to watch the child. ctx.asScala.unwatch(child) diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/WithMdcBehaviorInterceptor.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/WithMdcBehaviorInterceptor.scala index cf7b371e243..56d05a213cc 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/WithMdcBehaviorInterceptor.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/WithMdcBehaviorInterceptor.scala @@ -59,7 +59,7 @@ import pekko.annotation.InternalApi // so we need to look through the stack and eliminate any MCD already existing def loop(next: Behavior[T]): Behavior[T] = { next match { - case i: InterceptorImpl[_, T @unchecked] + case i: InterceptorImpl[?, T @unchecked] if i.interceptor.isSame(this.asInstanceOf[BehaviorInterceptor[Any, Any]]) => // eliminate that interceptor loop(i.nestedBehavior) @@ -83,7 +83,7 @@ import pekko.annotation.InternalApi // in the normal case, a new withMDC replaces the previous one override def isSame(other: BehaviorInterceptor[Any, Any]): Boolean = other match { - case _: WithMdcBehaviorInterceptor[_] => true + case _: WithMdcBehaviorInterceptor[?] => true case _ => false } diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/ActorAdapter.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/ActorAdapter.scala index 9638149134c..2e4a950dd86 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/ActorAdapter.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/ActorAdapter.scala @@ -180,7 +180,7 @@ import pekko.util.OptionVal } private def adaptAndHandle(msg: Any): Unit = { - @tailrec def handle(adapters: List[(Class[_], Any => T)]): Unit = { + @tailrec def handle(adapters: List[(Class[?], Any => T)]): Unit = { adapters match { case Nil => // no adapter function registered for message class @@ -240,7 +240,7 @@ import pekko.util.OptionVal case _ => val isTypedActor = sender() match { case afwc: ActorRefWithCell => - afwc.underlying.props.producer.actorClass == classOf[ActorAdapter[_]] + afwc.underlying.props.producer.actorClass == classOf[ActorAdapter[?]] case _ => false } @@ -326,7 +326,7 @@ import pekko.util.OptionVal try { ctx.cancelAllTimers() behavior match { - case _: DeferredBehavior[_] => + case _: DeferredBehavior[?] => // Do not undefer a DeferredBehavior as that may cause creation side-effects, which we do not want on termination. case b => Behavior.interpretSignal(b, ctx, PostStop) } @@ -352,7 +352,7 @@ import pekko.util.OptionVal // first pass the signal to the previous behavior, so that it and potential interceptors // will get the PostStop signal, unless it is deferred, we don't start a behavior while stopping lastBehavior match { - case _: DeferredBehavior[_] => // no starting of behaviors on actor stop + case _: DeferredBehavior[?] => // no starting of behaviors on actor stop case nonDeferred => Behavior.interpretSignal(nonDeferred, ctx, PostStop) } // and then to the potential stop hook, which can have a call back or not diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/ActorContextAdapter.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/ActorContextAdapter.scala index 551be08826e..15a2bfbe37a 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/ActorContextAdapter.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/ActorContextAdapter.scala @@ -25,19 +25,19 @@ import pekko.annotation.InternalApi @InternalApi private[pekko] object ActorContextAdapter { - private def toClassicImp[U](context: TypedActorContext[_]): classic.ActorContext = + private def toClassicImp[U](context: TypedActorContext[?]): classic.ActorContext = context match { - case adapter: ActorContextAdapter[_] => adapter.classicContext + case adapter: ActorContextAdapter[?] => adapter.classicContext case _ => throw new UnsupportedOperationException( "Only adapted classic ActorContext permissible " + s"($context of class ${context.getClass.getName})") } - def toClassic[U](context: scaladsl.ActorContext[_]): classic.ActorContext = + def toClassic[U](context: scaladsl.ActorContext[?]): classic.ActorContext = toClassicImp(context) - def toClassic[U](context: javadsl.ActorContext[_]): classic.ActorContext = + def toClassic[U](context: javadsl.ActorContext[?]): classic.ActorContext = toClassicImp(context) } diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/ActorRefAdapter.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/ActorRefAdapter.scala index 2d01edec09c..2f541642aae 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/ActorRefAdapter.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/ActorRefAdapter.scala @@ -59,8 +59,8 @@ private[pekko] object ActorRefAdapter { def toClassic[U](ref: ActorRef[U]): pekko.actor.InternalActorRef = ref match { - case adapter: ActorRefAdapter[_] => adapter.classicRef - case adapter: ActorSystemAdapter[_] => adapter.system.guardian + case adapter: ActorRefAdapter[?] => adapter.classicRef + case adapter: ActorSystemAdapter[?] => adapter.system.guardian case _ => throw new UnsupportedOperationException( "Only adapted classic ActorRefs permissible " + diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/ActorSystemAdapter.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/ActorSystemAdapter.scala index 039da8f7be1..79d3e282257 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/ActorSystemAdapter.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/ActorSystemAdapter.scala @@ -104,7 +104,7 @@ import pekko.util.FutureConverters._ } override def dynamicAccess: classic.DynamicAccess = system.dynamicAccess implicit override def executionContext: scala.concurrent.ExecutionContextExecutor = classicSystem.dispatcher - override val log: Logger = LoggerFactory.getLogger(classOf[ActorSystem[_]]) + override val log: Logger = LoggerFactory.getLogger(classOf[ActorSystem[?]]) override def logConfiguration(): Unit = classicSystem.logConfiguration() override def name: String = classicSystem.name override val scheduler: Scheduler = new SchedulerAdapter(classicSystem.scheduler) @@ -165,10 +165,10 @@ private[pekko] object ActorSystemAdapter { } object LoadTypedExtensions extends classic.ExtensionId[LoadTypedExtensions] with classic.ExtensionIdProvider { - override def lookup: actor.ExtensionId[_ <: actor.Extension] = this + override def lookup: actor.ExtensionId[? <: actor.Extension] = this override def createExtension(system: ExtendedActorSystem): LoadTypedExtensions = new LoadTypedExtensions(system) } - def toClassic[U](sys: ActorSystem[_]): classic.ActorSystem = sys.classicSystem + def toClassic[U](sys: ActorSystem[?]): classic.ActorSystem = sys.classicSystem } diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/receptionist/LocalReceptionist.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/receptionist/LocalReceptionist.scala index 5cc5a0b1d83..38269c7e421 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/receptionist/LocalReceptionist.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/receptionist/LocalReceptionist.scala @@ -71,9 +71,9 @@ private[pekko] object LocalReceptionist extends ReceptionistBehaviorProvider { */ private final case class State( services: TypedMultiMap[AbstractServiceKey, Service], - servicesPerActor: Map[ActorRef[_], Set[AbstractServiceKey]], + servicesPerActor: Map[ActorRef[?], Set[AbstractServiceKey]], subscriptions: TypedMultiMap[AbstractServiceKey, Subscriber], - subscriptionsPerActor: Map[ActorRef[_], Set[AbstractServiceKey]]) { + subscriptionsPerActor: Map[ActorRef[?], Set[AbstractServiceKey]]) { def serviceInstanceAdded[Key <: AbstractServiceKey](key: Key)(serviceInstance: ActorRef[key.Protocol]): State = { val newServices = services.inserted(key)(serviceInstance) @@ -101,7 +101,7 @@ private[pekko] object LocalReceptionist extends ReceptionistBehaviorProvider { copy(services = newServices, servicesPerActor = newServicePerActor) } - def serviceInstanceRemoved(serviceInstance: ActorRef[_]): State = { + def serviceInstanceRemoved(serviceInstance: ActorRef[?]): State = { val keys = servicesPerActor.getOrElse(serviceInstance, Set.empty) val newServices = if (keys.isEmpty) services @@ -140,7 +140,7 @@ private[pekko] object LocalReceptionist extends ReceptionistBehaviorProvider { copy(subscriptions = newSubscriptions, subscriptionsPerActor = newSubscriptionsPerActor) } - def subscriberRemoved(subscriber: ActorRef[_]): State = { + def subscriberRemoved(subscriber: ActorRef[?]): State = { val keys = subscriptionsPerActor.getOrElse(subscriber, Set.empty) if (keys.isEmpty) this else { diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/receptionist/ReceptionistImpl.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/receptionist/ReceptionistImpl.scala index 9dfcff15776..762e660feee 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/receptionist/ReceptionistImpl.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/receptionist/ReceptionistImpl.scala @@ -24,7 +24,7 @@ import pekko.annotation.InternalApi /** * INTERNAL API */ -@InternalApi private[pekko] class ReceptionistImpl(system: ActorSystem[_]) extends Receptionist { +@InternalApi private[pekko] class ReceptionistImpl(system: ActorSystem[?]) extends Receptionist { override val ref: ActorRef[Receptionist.Command] = { val provider: ReceptionistBehaviorProvider = diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/receptionist/ReceptionistMessages.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/receptionist/ReceptionistMessages.scala index 175a9debae3..2caf00bb94f 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/receptionist/ReceptionistMessages.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/receptionist/ReceptionistMessages.scala @@ -45,7 +45,7 @@ private[pekko] object ReceptionistMessages { final case class Registered[T] private[pekko] (key: ServiceKey[T], _serviceInstance: ActorRef[T]) extends Receptionist.Registered { - def isForKey(key: ServiceKey[_]): Boolean = key == this.key + def isForKey(key: ServiceKey[?]): Boolean = key == this.key def serviceInstance[M](key: ServiceKey[M]): ActorRef[M] = { if (key != this.key) throw new IllegalArgumentException(s"Wrong key [$key] used, must use listing key [${this.key}]") @@ -58,7 +58,7 @@ private[pekko] object ReceptionistMessages { final case class Deregistered[T] private[pekko] (key: ServiceKey[T], _serviceInstance: ActorRef[T]) extends Receptionist.Deregistered { - def isForKey(key: ServiceKey[_]): Boolean = key == this.key + def isForKey(key: ServiceKey[?]): Boolean = key == this.key def serviceInstance[M](key: ServiceKey[M]): ActorRef[M] = { if (key != this.key) throw new IllegalArgumentException(s"Wrong key [$key] used, must use listing key [${this.key}]") @@ -78,7 +78,7 @@ private[pekko] object ReceptionistMessages { servicesWereAddedOrRemoved: Boolean) extends Receptionist.Listing { - def isForKey(key: ServiceKey[_]): Boolean = key == this.key + def isForKey(key: ServiceKey[?]): Boolean = key == this.key def serviceInstances[M](key: ServiceKey[M]): Set[ActorRef[M]] = { if (key != this.key) diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/receptionist/ServiceKeySerializer.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/receptionist/ServiceKeySerializer.scala index c4cc527ef05..44d25905c79 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/receptionist/ServiceKeySerializer.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/receptionist/ServiceKeySerializer.scala @@ -28,13 +28,13 @@ final class ServiceKeySerializer(val system: pekko.actor.ExtendedActorSystem) extends SerializerWithStringManifest with BaseSerializer { def manifest(o: AnyRef): String = o match { - case key: DefaultServiceKey[_] => key.typeName + case key: DefaultServiceKey[?] => key.typeName case _ => throw new IllegalArgumentException(s"Can't serialize object of type ${o.getClass} in [${getClass.getName}]") } def toBinary(o: AnyRef): Array[Byte] = o match { - case serviceKey: DefaultServiceKey[_] => serviceKey.id.getBytes(StandardCharsets.UTF_8) + case serviceKey: DefaultServiceKey[?] => serviceKey.id.getBytes(StandardCharsets.UTF_8) case _ => throw new IllegalArgumentException(s"Cannot serialize object of type [${o.getClass.getName}]") } diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/routing/GroupRouterImpl.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/routing/GroupRouterImpl.scala index a7c35b348bd..4d006cf2e3d 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/routing/GroupRouterImpl.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/routing/GroupRouterImpl.scala @@ -33,7 +33,7 @@ import pekko.annotation.InternalApi private[pekko] final case class GroupRouterBuilder[T] private[pekko] ( key: ServiceKey[T], preferLocalRoutees: Boolean = false, - logicFactory: ActorSystem[_] => RoutingLogic[T] = (_: ActorSystem[_]) => new RoutingLogics.RandomLogic[T]()) + logicFactory: ActorSystem[?] => RoutingLogic[T] = (_: ActorSystem[?]) => new RoutingLogics.RandomLogic[T]()) extends javadsl.GroupRouter[T] with scaladsl.GroupRouter[T] { diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/routing/PoolRouterImpl.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/routing/PoolRouterImpl.scala index 8789052ad62..37e692e053d 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/routing/PoolRouterImpl.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/routing/PoolRouterImpl.scala @@ -30,7 +30,7 @@ import java.util.function.Predicate private[pekko] final case class PoolRouterBuilder[T]( poolSize: Int, behavior: Behavior[T], - logicFactory: ActorSystem[_] => RoutingLogic[T] = (_: ActorSystem[_]) => new RoutingLogics.RoundRobinLogic[T], + logicFactory: ActorSystem[?] => RoutingLogic[T] = (_: ActorSystem[?]) => new RoutingLogics.RoundRobinLogic[T], broadcastPredicate: T => Boolean = ConstantFun.anyToFalse, routeeProps: Props = Props.empty) extends javadsl.PoolRouter[T] diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/ActorContext.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/ActorContext.scala index 7dab2e674f8..c83440e8bdf 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/ActorContext.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/ActorContext.scala @@ -103,7 +103,7 @@ trait ActorContext[T] extends TypedActorContext[T] with ClassicActorContextProvi * *Warning*: This method is not thread-safe and must not be accessed from threads other * than the ordinary actor message processing thread, such as [[java.util.concurrent.CompletionStage]] callbacks. */ - def setLoggerName(clazz: Class[_]): Unit + def setLoggerName(clazz: Class[?]): Unit /** * The list of child Actors created by this Actor during its lifetime that diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/Adapter.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/Adapter.scala index 01b3b8479bd..1f9f4d4c240 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/Adapter.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/Adapter.scala @@ -108,10 +108,10 @@ object Adapter { def toTyped(sys: pekko.actor.ActorSystem): ActorSystem[Void] = sys.toTyped.asInstanceOf[ActorSystem[Void]] - def toClassic(sys: ActorSystem[_]): pekko.actor.ActorSystem = + def toClassic(sys: ActorSystem[?]): pekko.actor.ActorSystem = sys.toClassic - def toClassic(ctx: ActorContext[_]): actor.ActorContext = + def toClassic(ctx: ActorContext[?]): actor.ActorContext = ActorContextAdapter.toClassic(ctx) def watch[U](ctx: pekko.actor.ActorContext, other: ActorRef[U]): Unit = @@ -120,25 +120,25 @@ object Adapter { def unwatch[U](ctx: pekko.actor.ActorContext, other: ActorRef[U]): Unit = ctx.unwatch(other) - def stop(ctx: pekko.actor.ActorContext, child: ActorRef[_]): Unit = + def stop(ctx: pekko.actor.ActorContext, child: ActorRef[?]): Unit = ctx.stop(child) - def watch[U](ctx: ActorContext[_], other: pekko.actor.ActorRef): Unit = + def watch[U](ctx: ActorContext[?], other: pekko.actor.ActorRef): Unit = ctx.watch(other) - def unwatch[U](ctx: ActorContext[_], other: pekko.actor.ActorRef): Unit = + def unwatch[U](ctx: ActorContext[?], other: pekko.actor.ActorRef): Unit = ctx.unwatch(other) - def stop(ctx: ActorContext[_], child: pekko.actor.ActorRef): Unit = + def stop(ctx: ActorContext[?], child: pekko.actor.ActorRef): Unit = ctx.stop(child) - def actorOf(ctx: ActorContext[_], props: pekko.actor.Props): pekko.actor.ActorRef = + def actorOf(ctx: ActorContext[?], props: pekko.actor.Props): pekko.actor.ActorRef = ActorContextAdapter.toClassic(ctx).actorOf(props) - def actorOf(ctx: ActorContext[_], props: pekko.actor.Props, name: String): pekko.actor.ActorRef = + def actorOf(ctx: ActorContext[?], props: pekko.actor.Props, name: String): pekko.actor.ActorRef = ActorContextAdapter.toClassic(ctx).actorOf(props, name) - def toClassic(ref: ActorRef[_]): pekko.actor.ActorRef = + def toClassic(ref: ActorRef[?]): pekko.actor.ActorRef = ref.toClassic def toTyped[T](ref: pekko.actor.ActorRef): ActorRef[T] = diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/BehaviorBuilder.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/BehaviorBuilder.scala index 96b40477428..a8e4a5dd56f 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/BehaviorBuilder.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/BehaviorBuilder.scala @@ -81,7 +81,7 @@ final class BehaviorBuilder[T] private (messageHandlers: List[Case[T, T]], signa * @param handler action to apply when the type matches * @return a new behavior builder with the specified handling appended */ - def onMessageUnchecked[M <: T](`type`: Class[_ <: T], handler: JFunction[M, Behavior[T]]): BehaviorBuilder[T] = + def onMessageUnchecked[M <: T](`type`: Class[? <: T], handler: JFunction[M, Behavior[T]]): BehaviorBuilder[T] = withMessage[M](OptionVal.Some(`type`.asInstanceOf[Class[M]]), OptionVal.None, handler) /** @@ -173,7 +173,7 @@ object BehaviorBuilder { /** INTERNAL API */ @InternalApi private[javadsl] final case class Case[BT, MT]( - `type`: OptionVal[Class[_ <: MT]], + `type`: OptionVal[Class[? <: MT]], test: OptionVal[MT => Boolean], handler: JFunction[MT, Behavior[BT]]) diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/ReceiveBuilder.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/ReceiveBuilder.scala index ec60a85f74d..0e0b2419e23 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/ReceiveBuilder.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/ReceiveBuilder.scala @@ -76,7 +76,7 @@ final class ReceiveBuilder[T] private ( * @param handler action to apply when the type matches * @return this behavior builder */ - def onMessageUnchecked[M <: T](`type`: Class[_ <: T], handler: JFunction[M, Behavior[T]]): ReceiveBuilder[T] = + def onMessageUnchecked[M <: T](`type`: Class[? <: T], handler: JFunction[M, Behavior[T]]): ReceiveBuilder[T] = withMessage[M](OptionVal.Some(`type`.asInstanceOf[Class[M]]), OptionVal.None, handler) /** @@ -173,7 +173,7 @@ object ReceiveBuilder { /** INTERNAL API */ @InternalApi private[javadsl] final case class Case[BT, MT]( - `type`: OptionVal[Class[_ <: MT]], + `type`: OptionVal[Class[? <: MT]], test: OptionVal[JPredicate[MT]], handler: JFunction[MT, Behavior[BT]]) diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/receptionist/Receptionist.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/receptionist/Receptionist.scala index 57c995d00a3..f96cb94d8b6 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/receptionist/Receptionist.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/receptionist/Receptionist.scala @@ -104,8 +104,8 @@ abstract class ServiceKey[T] extends AbstractServiceKey { key => * The receptionist is easiest accessed through the system: [[ActorSystem.receptionist]] */ object Receptionist extends ExtensionId[Receptionist] { - def createExtension(system: ActorSystem[_]): Receptionist = new ReceptionistImpl(system) - def get(system: ActorSystem[_]): Receptionist = apply(system) + def createExtension(system: ActorSystem[?]): Receptionist = new ReceptionistImpl(system) + def get(system: ActorSystem[?]): Receptionist = apply(system) /** * The set of commands accepted by a Receptionist. @@ -172,13 +172,13 @@ object Receptionist extends ExtensionId[Receptionist] { @DoNotInherit trait Registered { - def isForKey(key: ServiceKey[_]): Boolean + def isForKey(key: ServiceKey[?]): Boolean /** Scala API */ - def key: ServiceKey[_] + def key: ServiceKey[?] /** Java API */ - def getKey: ServiceKey[_] = key + def getKey: ServiceKey[?] = key /** * Scala API @@ -255,13 +255,13 @@ object Receptionist extends ExtensionId[Receptionist] { @DoNotInherit trait Deregistered { - def isForKey(key: ServiceKey[_]): Boolean + def isForKey(key: ServiceKey[?]): Boolean /** Scala API */ - def key: ServiceKey[_] + def key: ServiceKey[?] /** Java API */ - def getKey: ServiceKey[_] = key + def getKey: ServiceKey[?] = key /** * Scala API @@ -354,12 +354,12 @@ object Receptionist extends ExtensionId[Receptionist] { trait Listing { /** Scala API */ - def key: ServiceKey[_] + def key: ServiceKey[?] /** Java API */ - def getKey: ServiceKey[_] = key + def getKey: ServiceKey[?] = key - def isForKey(key: ServiceKey[_]): Boolean + def isForKey(key: ServiceKey[?]): Boolean /** * Scala API: Return the reachable service instances. @@ -463,7 +463,7 @@ object Receptionist extends ExtensionId[Receptionist] { } object ReceptionistSetup { - def apply[T <: Extension](createExtension: ActorSystem[_] => Receptionist): ReceptionistSetup = + def apply[T <: Extension](createExtension: ActorSystem[?] => Receptionist): ReceptionistSetup = new ReceptionistSetup(createExtension(_)) } @@ -473,5 +473,5 @@ object ReceptionistSetup { * to replace the default implementation of the [[Receptionist]] extension. Intended * for tests that need to replace extension with stub/mock implementations. */ -final class ReceptionistSetup(createExtension: java.util.function.Function[ActorSystem[_], Receptionist]) +final class ReceptionistSetup(createExtension: java.util.function.Function[ActorSystem[?], Receptionist]) extends ExtensionSetup[Receptionist](Receptionist, createExtension) diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/scaladsl/ActorContext.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/scaladsl/ActorContext.scala index b8448cc2a75..6fdaf31225a 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/scaladsl/ActorContext.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/scaladsl/ActorContext.scala @@ -103,7 +103,7 @@ trait ActorContext[T] extends TypedActorContext[T] with ClassicActorContextProvi * *Warning*: This method is not thread-safe and must not be accessed from threads other * than the ordinary actor message processing thread, such as [[scala.concurrent.Future]] callbacks. */ - def setLoggerName(clazz: Class[_]): Unit + def setLoggerName(clazz: Class[?]): Unit /** * The list of child Actors created by this Actor during its lifetime that 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 66892700cb6..e5d5db31edb 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 @@ -40,7 +40,7 @@ object AskPattern { * Provides a scheduler from an actor system (that will likely already be implicit in the scope) to minimize ask * boilerplate. */ - implicit def schedulerFromActorSystem(implicit system: ActorSystem[_]): Scheduler = system.scheduler + implicit def schedulerFromActorSystem(implicit system: ActorSystem[?]): Scheduler = system.scheduler /** * See [[ask]] @@ -140,7 +140,7 @@ object AskPattern { private val onTimeout: String => Throwable = msg => new TimeoutException(msg) - private final class PromiseRef[U](target: InternalRecipientRef[_], timeout: Timeout) { + private final class PromiseRef[U](target: InternalRecipientRef[?], timeout: Timeout) { // Note: _promiseRef mustn't have a type pattern, since it can be null private[this] val (_ref: ActorRef[U], _future: Future[U], _promiseRef) = diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/scaladsl/adapter/package.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/scaladsl/adapter/package.scala index 18e6583eead..99b1039c549 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/scaladsl/adapter/package.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/scaladsl/adapter/package.scala @@ -83,7 +83,7 @@ package object adapter { /** * Extension methods added to [[pekko.actor.typed.ActorSystem]]. */ - implicit class TypedActorSystemOps(val sys: ActorSystem[_]) extends AnyVal { + implicit class TypedActorSystemOps(val sys: ActorSystem[?]) extends AnyVal { def toClassic: pekko.actor.ActorSystem = sys.classicSystem /** @@ -132,14 +132,14 @@ package object adapter { def watch[U](other: ActorRef[U]): Unit = ctx.watch(ActorRefAdapter.toClassic(other)) def unwatch[U](other: ActorRef[U]): Unit = ctx.unwatch(ActorRefAdapter.toClassic(other)) - def stop(child: ActorRef[_]): Unit = + def stop(child: ActorRef[?]): Unit = ctx.stop(ActorRefAdapter.toClassic(child)) } /** * Extension methods added to [[pekko.actor.typed.scaladsl.ActorContext]]. */ - implicit class TypedActorContextOps(val ctx: scaladsl.ActorContext[_]) extends AnyVal { + implicit class TypedActorContextOps(val ctx: scaladsl.ActorContext[?]) extends AnyVal { def actorOf(props: pekko.actor.Props): pekko.actor.ActorRef = ActorContextAdapter.toClassic(ctx).actorOf(props) @@ -154,7 +154,7 @@ package object adapter { /** * Extension methods added to [[pekko.actor.typed.ActorRef]]. */ - implicit class TypedActorRefOps(val ref: ActorRef[_]) extends AnyVal { + implicit class TypedActorRefOps(val ref: ActorRef[?]) extends AnyVal { def toClassic: pekko.actor.ActorRef = ActorRefAdapter.toClassic(ref) } diff --git a/actor/src/main/scala/org/apache/pekko/actor/AbstractProps.scala b/actor/src/main/scala/org/apache/pekko/actor/AbstractProps.scala index b8f9a4d77ca..f65e5b60d8c 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/AbstractProps.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/AbstractProps.scala @@ -31,7 +31,7 @@ private[pekko] trait AbstractProps { /** * INTERNAL API */ - private[pekko] def validate(clazz: Class[_]): Unit = { + private[pekko] def validate(clazz: Class[?]): Unit = { if (Modifier.isAbstract(clazz.getModifiers)) { throw new IllegalArgumentException(s"Actor class [${clazz.getName}] must not be abstract") } else if (!classOf[Actor].isAssignableFrom(clazz) && @@ -45,7 +45,7 @@ private[pekko] trait AbstractProps { * Java API: create a Props given a class and its constructor arguments. */ @varargs - def create(clazz: Class[_], args: AnyRef*): Props = + def create(clazz: Class[?], args: AnyRef*): Props = new Props(deploy = Props.defaultDeploy, clazz = clazz, args = args.toList) /** @@ -63,16 +63,16 @@ private[pekko] trait AbstractProps { checkCreatorClosingOver(cc) val ac = classOf[Actor] - val coc = classOf[Creator[_]] + val coc = classOf[Creator[?]] val actorClass = Reflect.findMarker(cc, coc) match { case t: ParameterizedType => t.getActualTypeArguments.head match { - case c: Class[_] => c // since T <: Actor - case v: TypeVariable[_] => - v.getBounds.collectFirst { case c: Class[_] if ac.isAssignableFrom(c) && c != ac => c }.getOrElse(ac) + case c: Class[?] => c // since T <: Actor + case v: TypeVariable[?] => + v.getBounds.collectFirst { case c: Class[?] if ac.isAssignableFrom(c) && c != ac => c }.getOrElse(ac) case x => throw new IllegalArgumentException(s"unsupported type found in Creator argument [$x]") } - case c: Class[_] if c == coc => + case c: Class[?] if c == coc => throw new IllegalArgumentException( "erased Creator types (e.g. lambdas) are unsupported, use Props.create(actorClass, creator) instead") case unexpected => @@ -89,10 +89,10 @@ private[pekko] trait AbstractProps { create(classOf[CreatorConsumer], actorClass, creator) } - private def checkCreatorClosingOver(clazz: Class[_]): Unit = { + private def checkCreatorClosingOver(clazz: Class[?]): Unit = { val enclosingClass = clazz.getEnclosingClass - def hasDeclaredConstructorWithEmptyParams(declaredConstructors: Array[Constructor[_]]): Boolean = { + def hasDeclaredConstructorWithEmptyParams(declaredConstructors: Array[Constructor[?]]): Boolean = { @tailrec def loop(i: Int): Boolean = { if (i == declaredConstructors.length) false else { @@ -105,7 +105,7 @@ private[pekko] trait AbstractProps { loop(0) } - def hasDeclaredConstructorWithEnclosingClassParam(declaredConstructors: Array[Constructor[_]]): Boolean = { + def hasDeclaredConstructorWithEnclosingClassParam(declaredConstructors: Array[Constructor[?]]): Boolean = { @tailrec def loop(i: Int): Boolean = { if (i == declaredConstructors.length) false else { 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 b6a085bacdd..bb1be982487 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/ActorCell.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/ActorCell.scala @@ -729,5 +729,5 @@ private[pekko] class ActorCell( try system.eventStream.publish(e) catch { case NonFatal(_) => } - protected final def clazz(o: AnyRef): Class[_] = if (o eq null) this.getClass else o.getClass + protected final def clazz(o: AnyRef): Class[?] = if (o eq null) this.getClass else o.getClass } diff --git a/actor/src/main/scala/org/apache/pekko/actor/ActorSystem.scala b/actor/src/main/scala/org/apache/pekko/actor/ActorSystem.scala index 6fe0dd0e26b..08799ccb6dc 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/ActorSystem.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/ActorSystem.scala @@ -719,7 +719,7 @@ abstract class ActorSystem extends ActorRefFactory with ClassicActorSystemProvid * Returns whether the specified extension is already registered, this method can potentially block, waiting for the initialization * of the payload, if is in the process of registration from another Thread of execution */ - def hasExtension(ext: ExtensionId[_ <: Extension]): Boolean + def hasExtension(ext: ExtensionId[? <: Extension]): Boolean } /** @@ -1142,7 +1142,7 @@ private[pekko] class ActorSystemImpl( // 1) a CountDownLatch (if it's still in the process of being registered), // 2) a Throwable (if it failed initializing), or // 3) the registered extension. - private val extensions = new ConcurrentHashMap[ExtensionId[_], AnyRef] + private val extensions = new ConcurrentHashMap[ExtensionId[?], AnyRef] /** * Returns any extension registered to the specified Extension or returns null if not registered @@ -1199,7 +1199,7 @@ private[pekko] class ActorSystemImpl( case some => some.asInstanceOf[T] } - def hasExtension(ext: ExtensionId[_ <: Extension]): Boolean = findExtension(ext) != null + def hasExtension(ext: ExtensionId[? <: Extension]): Boolean = findExtension(ext) != null private def loadExtensions(): Unit = { @@ -1217,7 +1217,7 @@ private[pekko] class ActorSystemImpl( } match { case Success(p: ExtensionIdProvider) => registerExtension(p.lookup) - case Success(p: ExtensionId[_]) => + case Success(p: ExtensionId[?]) => registerExtension(p) case Success(_) => if (!throwOnLoadFail) log.error("[{}] is not an 'ExtensionIdProvider' or 'ExtensionId', skipping...", fqcn) diff --git a/actor/src/main/scala/org/apache/pekko/actor/CoordinatedShutdown.scala b/actor/src/main/scala/org/apache/pekko/actor/CoordinatedShutdown.scala index 4b7baf9dacf..57dfc6555a3 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/CoordinatedShutdown.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/CoordinatedShutdown.scala @@ -319,7 +319,7 @@ object CoordinatedShutdown extends ExtensionId[CoordinatedShutdown] with Extensi depends-on = [] """) phasesConf.root.unwrapped.asScala.toMap.map { - case (k, _: java.util.Map[_, _]) => + case (k, _: java.util.Map[?, ?]) => val c = phasesConf.getConfig(k).withFallback(defaultPhaseConfig) val dependsOn = c.getStringList("depends-on").asScala.toSet val timeout = c.getDuration("timeout", MILLISECONDS).millis 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 b1210dc76bc..de0573ce50b 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/Deployer.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/Deployer.scala @@ -293,7 +293,7 @@ private[pekko] class Deployer(val settings: ActorSystem.Settings, val dynamicAcc val fqn = routerTypeMapping.getOrElse(routerType, routerType) - def throwCannotInstantiateRouter(args: Seq[(Class[_], AnyRef)], cause: Throwable) = + def throwCannotInstantiateRouter(args: Seq[(Class[?], AnyRef)], cause: Throwable) = throw new IllegalArgumentException( s"Cannot instantiate router [$fqn], defined in [$key], " + s"make sure it extends [${classOf[RouterConfig]}] and has constructor with " + diff --git a/actor/src/main/scala/org/apache/pekko/actor/DynamicAccess.scala b/actor/src/main/scala/org/apache/pekko/actor/DynamicAccess.scala index 0797c4444b5..dd89062f804 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/DynamicAccess.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/DynamicAccess.scala @@ -40,13 +40,13 @@ import pekko.annotation.DoNotInherit * val obj = DynamicAccess.createInstanceFor(clazz, Seq(classOf[Config] -> config, classOf[String] -> name)) * }}} */ - def createInstanceFor[T: ClassTag](clazz: Class[_], args: immutable.Seq[(Class[_], AnyRef)]): Try[T] + def createInstanceFor[T: ClassTag](clazz: Class[?], args: immutable.Seq[(Class[?], AnyRef)]): Try[T] /** * Obtain a `Class[_]` object loaded with the right class loader (i.e. the one * returned by `classLoader`). */ - def getClassFor[T: ClassTag](fqcn: String): Try[Class[_ <: T]] + def getClassFor[T: ClassTag](fqcn: String): Try[Class[? <: T]] def classIsOnClasspath(fqcn: String): Boolean @@ -57,7 +57,7 @@ import pekko.annotation.DoNotInherit * `args` argument. The exact usage of args depends on which type is requested, * see the relevant requesting code for details. */ - def createInstanceFor[T: ClassTag](fqcn: String, args: immutable.Seq[(Class[_], AnyRef)]): Try[T] + def createInstanceFor[T: ClassTag](fqcn: String, args: immutable.Seq[(Class[?], AnyRef)]): Try[T] /** * Obtain the Scala “object” instance for the given fully-qualified class name, if there is one. diff --git a/actor/src/main/scala/org/apache/pekko/actor/Extension.scala b/actor/src/main/scala/org/apache/pekko/actor/Extension.scala index 00dc881af39..4c34ede55c6 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/Extension.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/Extension.scala @@ -139,5 +139,5 @@ trait ExtensionIdProvider { /** * Returns the canonical ExtensionId for this Extension */ - def lookup: ExtensionId[_ <: Extension] + def lookup: ExtensionId[? <: Extension] } 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 7ee801a2476..5f9c332847d 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/FSM.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/FSM.scala @@ -229,13 +229,13 @@ object FSM { def canEqual(that: Any): Boolean = { that match { - case _: State[_, _] => true + case _: State[?, ?] => true case _ => false } } override def equals(that: Any) = that match { - case other: State[_, _] => + case other: State[?, ?] => other.canEqual(this) && this.stateName == other.stateName && this.stateData == other.stateData && diff --git a/actor/src/main/scala/org/apache/pekko/actor/FaultHandling.scala b/actor/src/main/scala/org/apache/pekko/actor/FaultHandling.scala index 4039cc340c3..a7fa867b094 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/FaultHandling.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/FaultHandling.scala @@ -245,17 +245,17 @@ object SupervisorStrategy extends SupervisorStrategyLowPriorityImplicits { * Implicit conversion from `Seq` of Throwables to a `Decider`. * This maps the given Throwables to restarts, otherwise escalates. */ - implicit def seqThrowable2Decider(trapExit: immutable.Seq[Class[_ <: Throwable]]): Decider = makeDecider(trapExit) + implicit def seqThrowable2Decider(trapExit: immutable.Seq[Class[? <: Throwable]]): Decider = makeDecider(trapExit) type Decider = PartialFunction[Throwable, Directive] type JDecider = pekko.japi.Function[Throwable, Directive] - type CauseDirective = (Class[_ <: Throwable], Directive) + type CauseDirective = (Class[? <: Throwable], Directive) /** * Decider builder which just checks whether one of * the given Throwables matches the cause and restarts, otherwise escalates. */ - def makeDecider(trapExit: immutable.Seq[Class[_ <: Throwable]]): Decider = { + def makeDecider(trapExit: immutable.Seq[Class[? <: Throwable]]): Decider = { case x => if (trapExit.exists(_.isInstance(x))) Restart else Escalate } @@ -263,7 +263,7 @@ object SupervisorStrategy extends SupervisorStrategyLowPriorityImplicits { * Decider builder which just checks whether one of * the given Throwables matches the cause and restarts, otherwise escalates. */ - def makeDecider(trapExit: JIterable[Class[_ <: Throwable]]): Decider = makeDecider(immutableSeq(trapExit)) + def makeDecider(trapExit: JIterable[Class[? <: Throwable]]): Decider = makeDecider(immutableSeq(trapExit)) /** * Decider builder for Iterables of cause-directive pairs, e.g. a map obtained @@ -506,13 +506,13 @@ case class AllForOneStrategy( /** * Java API */ - def this(maxNrOfRetries: Int, withinTimeRange: Duration, trapExit: JIterable[Class[_ <: Throwable]]) = + def this(maxNrOfRetries: Int, withinTimeRange: Duration, trapExit: JIterable[Class[? <: Throwable]]) = this(maxNrOfRetries, withinTimeRange)(SupervisorStrategy.makeDecider(trapExit)) /** * Java API */ - def this(maxNrOfRetries: Int, withinTimeRange: java.time.Duration, trapExit: JIterable[Class[_ <: Throwable]]) = + def this(maxNrOfRetries: Int, withinTimeRange: java.time.Duration, trapExit: JIterable[Class[? <: Throwable]]) = this(maxNrOfRetries, withinTimeRange.asScala)(SupervisorStrategy.makeDecider(trapExit)) /** @@ -618,13 +618,13 @@ case class OneForOneStrategy( /** * Java API */ - def this(maxNrOfRetries: Int, withinTimeRange: Duration, trapExit: JIterable[Class[_ <: Throwable]]) = + def this(maxNrOfRetries: Int, withinTimeRange: Duration, trapExit: JIterable[Class[? <: Throwable]]) = this(maxNrOfRetries, withinTimeRange)(SupervisorStrategy.makeDecider(trapExit)) /** * Java API */ - def this(maxNrOfRetries: Int, withinTimeRange: java.time.Duration, trapExit: JIterable[Class[_ <: Throwable]]) = + def this(maxNrOfRetries: Int, withinTimeRange: java.time.Duration, trapExit: JIterable[Class[? <: Throwable]]) = this(maxNrOfRetries, withinTimeRange.asScala)(SupervisorStrategy.makeDecider(trapExit)) /** diff --git a/actor/src/main/scala/org/apache/pekko/actor/IndirectActorProducer.scala b/actor/src/main/scala/org/apache/pekko/actor/IndirectActorProducer.scala index d10c99eb485..1e684ad2237 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/IndirectActorProducer.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/IndirectActorProducer.scala @@ -45,7 +45,7 @@ trait IndirectActorProducer { * that the instance created for calling `actorClass` is not necessarily reused * later to produce the actor. */ - def actorClass: Class[_ <: Actor] + def actorClass: Class[? <: Actor] } private[pekko] object IndirectActorProducer { @@ -53,7 +53,7 @@ private[pekko] object IndirectActorProducer { val CreatorConsumerClass = classOf[CreatorConsumer] val TypedCreatorFunctionConsumerClass = classOf[TypedCreatorFunctionConsumer] @nowarn - def apply(clazz: Class[_], args: immutable.Seq[Any]): IndirectActorProducer = { + def apply(clazz: Class[?], args: immutable.Seq[Any]): IndirectActorProducer = { if (classOf[IndirectActorProducer].isAssignableFrom(clazz)) { def get1stArg[T]: T = args.head.asInstanceOf[T] def get2ndArg[T]: T = args.tail.head.asInstanceOf[T] @@ -70,8 +70,8 @@ private[pekko] object IndirectActorProducer { Reflect.instantiate(clazz, args).asInstanceOf[IndirectActorProducer] } } else if (classOf[Actor].isAssignableFrom(clazz)) { - if (args.isEmpty) new NoArgsReflectConstructor(clazz.asInstanceOf[Class[_ <: Actor]]) - else new ArgsReflectConstructor(clazz.asInstanceOf[Class[_ <: Actor]], args) + if (args.isEmpty) new NoArgsReflectConstructor(clazz.asInstanceOf[Class[? <: Actor]]) + else new ArgsReflectConstructor(clazz.asInstanceOf[Class[? <: Actor]], args) } else throw new IllegalArgumentException(s"unknown actor creator [$clazz]") } } @@ -87,7 +87,7 @@ private[pekko] class CreatorFunctionConsumer(creator: () => Actor) extends Indir /** * INTERNAL API */ -private[pekko] class CreatorConsumer(clazz: Class[_ <: Actor], creator: Creator[Actor]) extends IndirectActorProducer { +private[pekko] class CreatorConsumer(clazz: Class[? <: Actor], creator: Creator[Actor]) extends IndirectActorProducer { override def actorClass = clazz override def produce() = creator.create() } @@ -95,7 +95,7 @@ private[pekko] class CreatorConsumer(clazz: Class[_ <: Actor], creator: Creator[ /** * INTERNAL API */ -private[pekko] class TypedCreatorFunctionConsumer(clz: Class[_ <: Actor], creator: () => Actor) +private[pekko] class TypedCreatorFunctionConsumer(clz: Class[? <: Actor], creator: () => Actor) extends IndirectActorProducer { override def actorClass = clz override def produce() = creator() @@ -104,7 +104,7 @@ private[pekko] class TypedCreatorFunctionConsumer(clz: Class[_ <: Actor], creato /** * INTERNAL API */ -private[pekko] class ArgsReflectConstructor(clz: Class[_ <: Actor], args: immutable.Seq[Any]) +private[pekko] class ArgsReflectConstructor(clz: Class[? <: Actor], args: immutable.Seq[Any]) extends IndirectActorProducer { private[this] val constructor = Reflect.findConstructor(clz, args) override def actorClass = clz @@ -114,7 +114,7 @@ private[pekko] class ArgsReflectConstructor(clz: Class[_ <: Actor], args: immuta /** * INTERNAL API */ -private[pekko] class NoArgsReflectConstructor(clz: Class[_ <: Actor]) extends IndirectActorProducer { +private[pekko] class NoArgsReflectConstructor(clz: Class[? <: Actor]) extends IndirectActorProducer { Reflect.findConstructor(clz, List.empty) override def actorClass = clz override def produce() = Reflect.instantiate(clz) diff --git a/actor/src/main/scala/org/apache/pekko/actor/Props.scala b/actor/src/main/scala/org/apache/pekko/actor/Props.scala index 80637e04fe2..69f2ef1f79c 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/Props.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/Props.scala @@ -87,13 +87,13 @@ object Props extends AbstractProps { def apply[T <: Actor: ClassTag](creator: => T): Props = mkProps(implicitly[ClassTag[T]].runtimeClass, () => creator) - private def mkProps(classOfActor: Class[_], ctor: () => Actor): Props = + private def mkProps(classOfActor: Class[?], ctor: () => Actor): Props = Props(classOf[TypedCreatorFunctionConsumer], classOfActor, ctor) /** * Scala API: create a Props given a class and its constructor arguments. */ - def apply(clazz: Class[_], args: Any*): Props = apply(defaultDeploy, clazz, args.toList) + def apply(clazz: Class[?], args: Any*): Props = apply(defaultDeploy, clazz, args.toList) } @@ -121,7 +121,7 @@ object Props extends AbstractProps { * }}} */ @SerialVersionUID(2L) -final case class Props(deploy: Deploy, clazz: Class[_], args: immutable.Seq[Any]) { +final case class Props(deploy: Deploy, clazz: Class[?], args: immutable.Seq[Any]) { Props.validate(clazz) @@ -131,7 +131,7 @@ final case class Props(deploy: Deploy, clazz: Class[_], args: immutable.Seq[Any] // derived property, does not need to be serialized @transient - private[this] var _cachedActorClass: Class[_ <: Actor] = _ + private[this] var _cachedActorClass: Class[? <: Actor] = _ /** * INTERNAL API @@ -143,7 +143,7 @@ final case class Props(deploy: Deploy, clazz: Class[_], args: immutable.Seq[Any] _producer } - private[this] def cachedActorClass: Class[_ <: Actor] = { + private[this] def cachedActorClass: Class[? <: Actor] = { if (_cachedActorClass eq null) _cachedActorClass = producer.actorClass @@ -223,7 +223,7 @@ final case class Props(deploy: Deploy, clazz: Class[_], args: immutable.Seq[Any] * the actor system to select special dispatchers or mailboxes in case * dependencies are encoded in the actor type. */ - def actorClass(): Class[_ <: Actor] = cachedActorClass + def actorClass(): Class[? <: Actor] = cachedActorClass /** * INTERNAL API diff --git a/actor/src/main/scala/org/apache/pekko/actor/ReflectiveDynamicAccess.scala b/actor/src/main/scala/org/apache/pekko/actor/ReflectiveDynamicAccess.scala index 75a7fa9d528..33df6ebaed3 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/ReflectiveDynamicAccess.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/ReflectiveDynamicAccess.scala @@ -34,14 +34,14 @@ import pekko.annotation.DoNotInherit @DoNotInherit class ReflectiveDynamicAccess(val classLoader: ClassLoader) extends DynamicAccess { - override def getClassFor[T: ClassTag](fqcn: String): Try[Class[_ <: T]] = - Try[Class[_ <: T]] { - val c = Class.forName(fqcn, false, classLoader).asInstanceOf[Class[_ <: T]] + override def getClassFor[T: ClassTag](fqcn: String): Try[Class[? <: T]] = + Try[Class[? <: T]] { + val c = Class.forName(fqcn, false, classLoader).asInstanceOf[Class[? <: T]] val t = implicitly[ClassTag[T]].runtimeClass if (t.isAssignableFrom(c)) c else throw new ClassCastException(t.toString + " is not assignable from " + c) } - override def createInstanceFor[T: ClassTag](clazz: Class[_], args: immutable.Seq[(Class[_], AnyRef)]): Try[T] = + override def createInstanceFor[T: ClassTag](clazz: Class[?], args: immutable.Seq[(Class[?], AnyRef)]): Try[T] = Try { val types = args.map(_._1).toArray val values = args.map(_._2).toArray @@ -53,7 +53,7 @@ class ReflectiveDynamicAccess(val classLoader: ClassLoader) extends DynamicAcces else throw new ClassCastException(clazz.getName + " is not a subtype of " + t) }.recover { case i: InvocationTargetException if i.getTargetException ne null => throw i.getTargetException } - override def createInstanceFor[T: ClassTag](fqcn: String, args: immutable.Seq[(Class[_], AnyRef)]): Try[T] = + override def createInstanceFor[T: ClassTag](fqcn: String, args: immutable.Seq[(Class[?], AnyRef)]): Try[T] = getClassFor(fqcn).flatMap { c => createInstanceFor(c, args) } 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..ba7ac577be7 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/TypedActor.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/TypedActor.scala @@ -148,9 +148,9 @@ object TypedActor extends ExtensionId[TypedActorExtension] with ExtensionIdProvi final case class MethodCall(method: Method, parameters: Array[AnyRef]) { def isOneWay = method.getReturnType == java.lang.Void.TYPE - def returnsFuture = classOf[Future[_]].isAssignableFrom(method.getReturnType) - def returnsJOption = classOf[pekko.japi.Option[_]].isAssignableFrom(method.getReturnType) - def returnsOption = classOf[scala.Option[_]].isAssignableFrom(method.getReturnType) + def returnsFuture = classOf[Future[?]].isAssignableFrom(method.getReturnType) + def returnsJOption = classOf[pekko.japi.Option[?]].isAssignableFrom(method.getReturnType) + def returnsOption = classOf[scala.Option[?]].isAssignableFrom(method.getReturnType) /** * Invokes the Method on the supplied instance @@ -190,9 +190,9 @@ object TypedActor extends ExtensionId[TypedActorExtension] with ExtensionIdProvi * Represents the serialized form of a MethodCall, uses readResolve and writeReplace to marshall the call */ private[pekko] final case class SerializedMethodCall( - ownerType: Class[_], + ownerType: Class[?], methodName: String, - parameterTypes: Array[Class[_]], + parameterTypes: Array[Class[?]], serializedParameters: Array[(Int, String, Array[Byte])]) { // TODO implement writeObject and readObject to serialize @@ -274,7 +274,7 @@ object TypedActor extends ExtensionId[TypedActorExtension] with ExtensionIdProvi private[pekko] class TypedActor[R <: AnyRef, T <: R]( val proxyVar: AtomVar[R], createInstance: => T, - interfaces: immutable.Seq[Class[_]]) + interfaces: immutable.Seq[Class[?]]) extends Actor { self => // if we were remote deployed we need to create a local proxy @@ -349,7 +349,7 @@ object TypedActor extends ExtensionId[TypedActorExtension] with ExtensionIdProvi try { val s = sender() m(me) match { - case f: Future[_] if m.returnsFuture => + case f: Future[?] if m.returnsFuture => implicit val dispatcher = this.context.dispatcher f.onComplete { case Success(result) => @@ -487,7 +487,7 @@ object TypedActor extends ExtensionId[TypedActorExtension] with ExtensionIdProvi } catch { case _: TimeoutException => None }) match { case None | Some(Success(NullResponse)) | Some(Failure(_: AskTimeoutException)) => if (m.returnsJOption) JOption.none[Any] else None - case Some(t: Try[_]) => + case Some(t: Try[?]) => t.get.asInstanceOf[AnyRef] } case m => @@ -537,7 +537,7 @@ object TypedProps { * @return a sequence of interfaces that the specified class implements, * or a sequence containing only itself, if itself is an interface. */ - def extractInterfaces(clazz: Class[_]): immutable.Seq[Class[_]] = + def extractInterfaces(clazz: Class[?]): immutable.Seq[Class[?]] = if (clazz.isInterface) immutableSingletonSeq(clazz) else immutableSeq(clazz.getInterfaces) /** @@ -557,7 +557,7 @@ object TypedProps { * * Scala API */ - def apply[T <: AnyRef](interface: Class[_ >: T], implementation: Class[T]): TypedProps[T] = + def apply[T <: AnyRef](interface: Class[? >: T], implementation: Class[T]): TypedProps[T] = new TypedProps[T](extractInterfaces(interface), instantiator(implementation)) /** @@ -568,7 +568,7 @@ object TypedProps { * * Scala API */ - def apply[T <: AnyRef](interface: Class[_ >: T], creator: => T): TypedProps[T] = + def apply[T <: AnyRef](interface: Class[? >: T], creator: => T): TypedProps[T] = new TypedProps[T](extractInterfaces(interface), () => creator) /** @@ -583,7 +583,7 @@ object TypedProps { /** * INTERNAL API */ - private[pekko] def apply[T <: AnyRef](interfaces: immutable.Seq[Class[_]], creator: => T): TypedProps[T] = + private[pekko] def apply[T <: AnyRef](interfaces: immutable.Seq[Class[?]], creator: => T): TypedProps[T] = new TypedProps[T](interfaces, () => creator) } @@ -593,7 +593,7 @@ object TypedProps { */ @SerialVersionUID(1L) final case class TypedProps[T <: AnyRef] protected[TypedProps] ( - interfaces: immutable.Seq[Class[_]], + interfaces: immutable.Seq[Class[?]], creator: () => T, dispatcher: String = TypedProps.defaultDispatcherId, deploy: Deploy = Props.defaultDeploy, @@ -615,7 +615,7 @@ final case class TypedProps[T <: AnyRef] protected[TypedProps] ( * or if the interface class is not an interface, all the interfaces it implements, * appended in the sequence of interfaces. */ - def this(interface: Class[_ >: T], implementation: Creator[T]) = + def this(interface: Class[? >: T], implementation: Creator[T]) = this(interfaces = TypedProps.extractInterfaces(interface), creator = implementation.create _) /** @@ -624,7 +624,7 @@ final case class TypedProps[T <: AnyRef] protected[TypedProps] ( * or if the interface class is not an interface, all the interfaces it implements, * appended in the sequence of interfaces. */ - def this(interface: Class[_ >: T], implementation: Class[T]) = + def this(interface: Class[? >: T], implementation: Class[T]) = this(interfaces = TypedProps.extractInterfaces(interface), creator = instantiator(implementation)) /** @@ -668,14 +668,14 @@ final case class TypedProps[T <: AnyRef] protected[TypedProps] ( * or if the interface class is not an interface, all the interfaces it implements, * appended in the sequence of interfaces. */ - def withInterface(interface: Class[_ >: T]): TypedProps[T] = + def withInterface(interface: Class[? >: T]): TypedProps[T] = this.copy(interfaces = interfaces ++ TypedProps.extractInterfaces(interface)) /** * Returns a new TypedProps without the specified interface, * or if the interface class is not an interface, all the interfaces it implements. */ - def withoutInterface(interface: Class[_ >: T]): TypedProps[T] = + def withoutInterface(interface: Class[? >: T]): TypedProps[T] = this.copy(interfaces = interfaces.diff(TypedProps.extractInterfaces(interface))) /** diff --git a/actor/src/main/scala/org/apache/pekko/actor/dungeon/ChildrenContainer.scala b/actor/src/main/scala/org/apache/pekko/actor/dungeon/ChildrenContainer.scala index e950d498787..b1cc7139c24 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/dungeon/ChildrenContainer.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/dungeon/ChildrenContainer.scala @@ -59,14 +59,14 @@ private[pekko] object ChildrenContainer { final case class Creation() extends SuspendReason with WaitingForChildren case object Termination extends SuspendReason - class ChildRestartsIterable(stats: immutable.Map[_, ChildStats]) + class ChildRestartsIterable(stats: immutable.Map[?, ChildStats]) extends PartialImmutableValuesIterable[ChildStats, ChildRestartStats] { override final def apply(c: ChildStats) = c.asInstanceOf[ChildRestartStats] override final def isDefinedAt(c: ChildStats) = c.isInstanceOf[ChildRestartStats] override final def valuesIterator = stats.valuesIterator } - class ChildrenIterable(stats: immutable.Map[_, ChildStats]) + class ChildrenIterable(stats: immutable.Map[?, ChildStats]) extends PartialImmutableValuesIterable[ChildStats, ActorRef] { override final def apply(c: ChildStats) = c.asInstanceOf[ChildRestartStats].child override final def isDefinedAt(c: ChildStats) = c.isInstanceOf[ChildRestartStats] diff --git a/actor/src/main/scala/org/apache/pekko/actor/dungeon/Dispatch.scala b/actor/src/main/scala/org/apache/pekko/actor/dungeon/Dispatch.scala index 99211122951..47fb2e6739f 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/dungeon/Dispatch.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/dungeon/Dispatch.scala @@ -89,7 +89,7 @@ private[pekko] trait Dispatch { this: ActorCell => // it properly in the normal way val actorClass = props.actorClass() val createMessage = mailboxType match { - case _: ProducesMessageQueue[_] if system.mailboxes.hasRequiredType(actorClass) => + case _: ProducesMessageQueue[?] if system.mailboxes.hasRequiredType(actorClass) => val req = system.mailboxes.getRequiredType(actorClass) if (req.isInstance(mbox.messageQueue)) Create(None) else { diff --git a/actor/src/main/scala/org/apache/pekko/actor/setup/ActorSystemSetup.scala b/actor/src/main/scala/org/apache/pekko/actor/setup/ActorSystemSetup.scala index db019283793..e60b0eb21c2 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/setup/ActorSystemSetup.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/setup/ActorSystemSetup.scala @@ -61,7 +61,7 @@ object ActorSystemSetup { * Constructor is *Internal API*. Use the factory methods [[ActorSystemSetup#create]] and [[ActorSystemSetup#apply]] to create * instances. */ -final class ActorSystemSetup private[pekko] (@InternalApi private[pekko] val setups: Map[Class[_], AnyRef]) { +final class ActorSystemSetup private[pekko] (@InternalApi private[pekko] val setups: Map[Class[?], AnyRef]) { /** * Java API: Extract a concrete [[pekko.actor.setup.Setup]] of type `T` if it is defined in the settings. diff --git a/actor/src/main/scala/org/apache/pekko/dispatch/ForkJoinExecutorConfigurator.scala b/actor/src/main/scala/org/apache/pekko/dispatch/ForkJoinExecutorConfigurator.scala index 4a2e168f0ab..b2f0622d668 100644 --- a/actor/src/main/scala/org/apache/pekko/dispatch/ForkJoinExecutorConfigurator.scala +++ b/actor/src/main/scala/org/apache/pekko/dispatch/ForkJoinExecutorConfigurator.scala @@ -38,7 +38,7 @@ object ForkJoinExecutorConfigurator { override def execute(r: Runnable): Unit = if (r ne null) super.execute( - (if (r.isInstanceOf[ForkJoinTask[_]]) r else new PekkoForkJoinTask(r)).asInstanceOf[ForkJoinTask[Any]]) + (if (r.isInstanceOf[ForkJoinTask[?]]) r else new PekkoForkJoinTask(r)).asInstanceOf[ForkJoinTask[Any]]) else throw new NullPointerException("Runnable was null") diff --git a/actor/src/main/scala/org/apache/pekko/dispatch/Mailboxes.scala b/actor/src/main/scala/org/apache/pekko/dispatch/Mailboxes.scala index 9a7aa116711..0f2c6431851 100644 --- a/actor/src/main/scala/org/apache/pekko/dispatch/Mailboxes.scala +++ b/actor/src/main/scala/org/apache/pekko/dispatch/Mailboxes.scala @@ -73,7 +73,7 @@ private[pekko] class Mailboxes( private val mailboxTypeConfigurators = new ConcurrentHashMap[String, MailboxType] - private val mailboxBindings: Map[Class[_ <: Any], String] = { + private val mailboxBindings: Map[Class[? <: Any], String] = { import pekko.util.ccompat.JavaConverters._ settings.config .getConfig("pekko.actor.mailbox.requirements") @@ -81,7 +81,7 @@ private[pekko] class Mailboxes( .unwrapped .asScala .toMap - .foldLeft(Map.empty[Class[_ <: Any], String]) { + .foldLeft(Map.empty[Class[? <: Any], String]) { case (m, (k, v)) => dynamicAccess .getClassFor[Any](k) @@ -107,18 +107,18 @@ private[pekko] class Mailboxes( /** * Returns a mailbox type as specified in configuration, based on the type, or if not defined None. */ - def lookupByQueueType(queueType: Class[_ <: Any]): MailboxType = lookup(lookupId(queueType)) + def lookupByQueueType(queueType: Class[? <: Any]): MailboxType = lookup(lookupId(queueType)) - private final val rmqClass = classOf[RequiresMessageQueue[_]] + private final val rmqClass = classOf[RequiresMessageQueue[?]] /** * Return the required message queue type for this class if any. */ - def getRequiredType(actorClass: Class[_ <: Actor]): Class[_] = + def getRequiredType(actorClass: Class[? <: Actor]): Class[?] = Reflect.findMarker(actorClass, rmqClass) match { case t: ParameterizedType => t.getActualTypeArguments.head match { - case c: Class[_] => c + case c: Class[?] => c case x => throw new IllegalArgumentException(s"no wildcard type allowed in RequireMessageQueue argument (was [$x])") } @@ -135,14 +135,14 @@ private[pekko] class Mailboxes( case x => dynamicAccess.getClassFor[AnyRef](x).get } - def getProducedMessageQueueType(mailboxType: MailboxType): Class[_] = { - val pmqClass = classOf[ProducesMessageQueue[_]] + def getProducedMessageQueueType(mailboxType: MailboxType): Class[?] = { + val pmqClass = classOf[ProducesMessageQueue[?]] if (!pmqClass.isAssignableFrom(mailboxType.getClass)) classOf[MessageQueue] else Reflect.findMarker(mailboxType.getClass, pmqClass) match { case t: ParameterizedType => t.getActualTypeArguments.head match { - case c: Class[_] => c + case c: Class[?] => c case x => throw new IllegalArgumentException( s"no wildcard type allowed in ProducesMessageQueue argument (was [$x])") @@ -161,7 +161,7 @@ private[pekko] class Mailboxes( val actorClass = props.actorClass() lazy val actorRequirement = getRequiredType(actorClass) - val mailboxRequirement: Class[_] = getMailboxRequirement(dispatcherConfig) + val mailboxRequirement: Class[?] = getMailboxRequirement(dispatcherConfig) val hasMailboxRequirement: Boolean = mailboxRequirement != classOf[MessageQueue] @@ -180,7 +180,7 @@ private[pekko] class Mailboxes( } def verifyRequirements(mailboxType: MailboxType): MailboxType = { - lazy val mqType: Class[_] = getProducedMessageQueueType(mailboxType) + lazy val mqType: Class[?] = getProducedMessageQueueType(mailboxType) if (hasMailboxRequirement && !mailboxRequirement.isAssignableFrom(mqType)) throw new IllegalArgumentException( s"produced message queue type [$mqType] does not fulfill requirement for dispatcher [$id]. " + @@ -211,9 +211,9 @@ private[pekko] class Mailboxes( /** * Check if this class can have a required message queue type. */ - def hasRequiredType(actorClass: Class[_ <: Actor]): Boolean = rmqClass.isAssignableFrom(actorClass) + def hasRequiredType(actorClass: Class[? <: Actor]): Boolean = rmqClass.isAssignableFrom(actorClass) - private def lookupId(queueType: Class[_]): String = + private def lookupId(queueType: Class[?]): String = mailboxBindings.get(queueType) match { case None => throw new ConfigurationException(s"Mailbox Mapping for [$queueType] not configured") case Some(s) => s diff --git a/actor/src/main/scala/org/apache/pekko/dispatch/ThreadPoolBuilder.scala b/actor/src/main/scala/org/apache/pekko/dispatch/ThreadPoolBuilder.scala index c292be9de87..c84a6912abc 100644 --- a/actor/src/main/scala/org/apache/pekko/dispatch/ThreadPoolBuilder.scala +++ b/actor/src/main/scala/org/apache/pekko/dispatch/ThreadPoolBuilder.scala @@ -243,14 +243,14 @@ trait ExecutorServiceDelegate extends ExecutorService { def submit(runnable: Runnable) = executor.submit(runnable) - def invokeAll[T](callables: Collection[_ <: Callable[T]]) = executor.invokeAll(callables) + def invokeAll[T](callables: Collection[? <: Callable[T]]) = executor.invokeAll(callables) - def invokeAll[T](callables: Collection[_ <: Callable[T]], l: Long, timeUnit: TimeUnit) = + def invokeAll[T](callables: Collection[? <: Callable[T]], l: Long, timeUnit: TimeUnit) = executor.invokeAll(callables, l, timeUnit) - def invokeAny[T](callables: Collection[_ <: Callable[T]]) = executor.invokeAny(callables) + def invokeAny[T](callables: Collection[? <: Callable[T]]) = executor.invokeAny(callables) - def invokeAny[T](callables: Collection[_ <: Callable[T]], l: Long, timeUnit: TimeUnit) = + def invokeAny[T](callables: Collection[? <: Callable[T]], l: Long, timeUnit: TimeUnit) = executor.invokeAny(callables, l, timeUnit) } diff --git a/actor/src/main/scala/org/apache/pekko/event/EventStream.scala b/actor/src/main/scala/org/apache/pekko/event/EventStream.scala index 93c63263515..aed00a636a7 100644 --- a/actor/src/main/scala/org/apache/pekko/event/EventStream.scala +++ b/actor/src/main/scala/org/apache/pekko/event/EventStream.scala @@ -36,24 +36,24 @@ class EventStream(sys: ActorSystem, private val debug: Boolean) extends LoggingB def this(sys: ActorSystem) = this(sys, debug = false) type Event = Any - type Classifier = Class[_] + type Classifier = Class[?] /** Either the list of subscribed actors, or a ref to an [[pekko.event.EventStreamUnsubscriber]] */ private val initiallySubscribedOrUnsubscriber = new AtomicReference[Either[Set[ActorRef], ActorRef]](Left(Set.empty)) - protected implicit val subclassification: Subclassification[Classifier] = new Subclassification[Class[_]] { - def isEqual(x: Class[_], y: Class[_]) = x == y - def isSubclass(x: Class[_], y: Class[_]) = y.isAssignableFrom(x) + protected implicit val subclassification: Subclassification[Classifier] = new Subclassification[Class[?]] { + def isEqual(x: Class[?], y: Class[?]) = x == y + def isSubclass(x: Class[?], y: Class[?]) = y.isAssignableFrom(x) } - protected def classify(event: Any): Class[_] = event.getClass + protected def classify(event: Any): Class[?] = event.getClass protected def publish(event: Any, subscriber: ActorRef) = { if (sys == null && subscriber.isTerminated) unsubscribe(subscriber) else subscriber ! event } - override def subscribe(subscriber: ActorRef, channel: Class[_]): Boolean = { + override def subscribe(subscriber: ActorRef, channel: Class[?]): Boolean = { if (subscriber eq null) throw new IllegalArgumentException("subscriber is null") if (debug) publish(Logging.Debug(simpleName(this), this.getClass, "subscribing " + subscriber + " to channel " + channel)) @@ -61,7 +61,7 @@ class EventStream(sys: ActorSystem, private val debug: Boolean) extends LoggingB super.subscribe(subscriber, channel) } - override def unsubscribe(subscriber: ActorRef, channel: Class[_]): Boolean = { + override def unsubscribe(subscriber: ActorRef, channel: Class[?]): Boolean = { if (subscriber eq null) throw new IllegalArgumentException("subscriber is null") val ret = super.unsubscribe(subscriber, channel) unregisterIfNoMoreSubscribedChannels(subscriber) 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 2a9bb428203..a9ba811b847 100644 --- a/actor/src/main/scala/org/apache/pekko/event/Logging.scala +++ b/actor/src/main/scala/org/apache/pekko/event/Logging.scala @@ -46,7 +46,7 @@ import pekko.util.unused trait LoggingBus extends ActorEventBus { type Event >: Logging.LogEvent - type Classifier >: Class[_] + type Classifier >: Class[?] import Logging._ @@ -206,7 +206,7 @@ trait LoggingBus extends ActorEventBus { */ private def addLogger( system: ActorSystemImpl, - clazz: Class[_ <: Actor], + clazz: Class[? <: Actor], level: LogLevel, logName: String): ActorRef = { val name = "log" + LogExt(system).id() + "-" + simpleName(clazz) @@ -281,13 +281,13 @@ trait LoggingBus extends ActorEventBus { -T] { def genString(t: T): String def genString(t: T, @unused system: ActorSystem): String = genString(t) - def getClazz(t: T): Class[_] = t.getClass + def getClazz(t: T): Class[?] = t.getClass } /** * INTERNAL API */ -@InternalApi private[pekko] final case class ActorWithLogClass(actor: Actor, logClass: Class[_]) +@InternalApi private[pekko] final case class ActorWithLogClass(actor: Actor, logClass: Class[?]) /** * This is a “marker” class which is inserted as originator class into @@ -345,14 +345,14 @@ object LogSource { new LogSource[ActorWithLogClass] { def genString(a: ActorWithLogClass) = fromActor.genString(a.actor) override def genString(a: ActorWithLogClass, system: ActorSystem) = fromActor.genString(a.actor, system) - override def getClazz(a: ActorWithLogClass): Class[_] = a.logClass + override def getClazz(a: ActorWithLogClass): Class[?] = a.logClass } // this one unfortunately does not work as implicit, because existential types have some weird behavior - val fromClass: LogSource[Class[_]] = new LogSource[Class[_]] { - def genString(c: Class[_]): String = Logging.simpleName(c) - override def genString(c: Class[_], system: ActorSystem): String = genString(c) + "(" + system + ")" - override def getClazz(c: Class[_]): Class[_] = c + val fromClass: LogSource[Class[?]] = new LogSource[Class[?]] { + def genString(c: Class[?]): String = Logging.simpleName(c) + override def genString(c: Class[?], system: ActorSystem): String = genString(c) + "(" + system + ")" + override def getClazz(c: Class[?]): Class[?] = c } implicit def fromAnyClass[T]: LogSource[Class[T]] = fromClass.asInstanceOf[LogSource[Class[T]]] @@ -360,7 +360,7 @@ object LogSource { * Convenience converter access: given an implicit `LogSource`, generate the * string representation and originating class. */ - def apply[T: LogSource](o: T): (String, Class[_]) = { + def apply[T: LogSource](o: T): (String, Class[?]) = { val ls = implicitly[LogSource[T]] (ls.genString(o), ls.getClazz(o)) } @@ -370,7 +370,7 @@ object LogSource { * [[pekko.actor.ActorSystem]], generate the string representation and * originating class. */ - def apply[T: LogSource](o: T, system: ActorSystem): (String, Class[_]) = { + def apply[T: LogSource](o: T, system: ActorSystem): (String, Class[?]) = { val ls = implicitly[LogSource[T]] (ls.genString(o, system), ls.getClazz(o)) } @@ -379,9 +379,9 @@ object LogSource { * construct string representation for any object according to * rules above with fallback to its `Class`’s simple name. */ - def fromAnyRef(o: AnyRef): (String, Class[_]) = + def fromAnyRef(o: AnyRef): (String, Class[?]) = o match { - case c: Class[_] => apply(c) + case c: Class[?] => apply(c) case a: Actor => apply(a) case a: ActorRef => apply(a) case s: String => apply(s) @@ -393,9 +393,9 @@ object LogSource { * rules above (including the actor system’s address) with fallback to its * `Class`’s simple name. */ - def fromAnyRef(o: AnyRef, system: ActorSystem): (String, Class[_]) = + def fromAnyRef(o: AnyRef, system: ActorSystem): (String, Class[?]) = o match { - case c: Class[_] => apply(c) + case c: Class[?] => apply(c) case a: Actor => apply(a) case a: ActorRef => apply(a) case s: String => apply(s) @@ -448,7 +448,7 @@ object Logging { * Returns a 'safe' getSimpleName for the provided Class * @return the simple name of the given Class */ - def simpleName(clazz: Class[_]): String = { + def simpleName(clazz: Class[?]): String = { val n = clazz.getName val i = n.lastIndexOf('.') n.substring(i + 1) @@ -529,7 +529,7 @@ object Logging { * Returns the LogLevel associated with the given event class. * Defaults to DebugLevel. */ - def levelFor(eventClass: Class[_ <: LogEvent]): LogLevel = { + def levelFor(eventClass: Class[? <: LogEvent]): LogLevel = { if (classOf[Error].isAssignableFrom(eventClass)) ErrorLevel else if (classOf[Warning].isAssignableFrom(eventClass)) WarningLevel else if (classOf[Info].isAssignableFrom(eventClass)) InfoLevel @@ -540,7 +540,7 @@ object Logging { /** * Returns the event class associated with the given LogLevel */ - def classFor(level: LogLevel): Class[_ <: LogEvent] = level match { + def classFor(level: LogLevel): Class[? <: LogEvent] = level match { case ErrorLevel => classOf[Error] case WarningLevel => classOf[Warning] case InfoLevel => classOf[Info] @@ -748,7 +748,7 @@ object Logging { /** * The class of the source of this event */ - def logClass: Class[_] + def logClass: Class[?] /** * The message, may be any object or null. @@ -770,7 +770,7 @@ object Logging { } object LogEvent { - def apply(level: LogLevel, logSource: String, logClass: Class[_], message: Any): LogEvent = level match { + def apply(level: LogLevel, logSource: String, logClass: Class[?], message: Any): LogEvent = level match { case ErrorLevel => Error(logSource, logClass, message) case WarningLevel => Warning(logSource, logClass, message) case InfoLevel => Info(logSource, logClass, message) @@ -778,7 +778,7 @@ object Logging { case level => throw new IllegalArgumentException(s"Unsupported log level [$level]") } - def apply(level: LogLevel, logSource: String, logClass: Class[_], message: Any, mdc: MDC): LogEvent = level match { + def apply(level: LogLevel, logSource: String, logClass: Class[?], message: Any, mdc: MDC): LogEvent = level match { case ErrorLevel => Error(logSource, logClass, message, mdc) case WarningLevel => Warning(logSource, logClass, message, mdc) case InfoLevel => Info(logSource, logClass, message, mdc) @@ -789,7 +789,7 @@ object Logging { def apply( level: LogLevel, logSource: String, - logClass: Class[_], + logClass: Class[?], message: Any, mdc: MDC, marker: LogMarker): LogEvent = level match { @@ -809,49 +809,49 @@ object Logging { /** * For ERROR Logging */ - case class Error(override val cause: Throwable, logSource: String, logClass: Class[_], message: Any = "") + case class Error(override val cause: Throwable, logSource: String, logClass: Class[?], message: Any = "") extends LogEvent with LogEventWithCause { - def this(logSource: String, logClass: Class[_], message: Any) = this(Error.NoCause, logSource, logClass, message) + def this(logSource: String, logClass: Class[?], message: Any) = this(Error.NoCause, logSource, logClass, message) override def level = ErrorLevel } class Error2( override val cause: Throwable, logSource: String, - logClass: Class[_], + logClass: Class[?], message: Any = "", override val mdc: MDC) extends Error(cause, logSource, logClass, message) { - def this(logSource: String, logClass: Class[_], message: Any, mdc: MDC) = + def this(logSource: String, logClass: Class[?], message: Any, mdc: MDC) = this(Error.NoCause, logSource, logClass, message, mdc) } class Error3( override val cause: Throwable, logSource: String, - logClass: Class[_], + logClass: Class[?], message: Any, override val mdc: MDC, override val marker: LogMarker) extends Error2(cause, logSource, logClass, message, mdc) with LogEventWithMarker { - def this(logSource: String, logClass: Class[_], message: Any, mdc: MDC, marker: LogMarker) = + def this(logSource: String, logClass: Class[?], message: Any, mdc: MDC, marker: LogMarker) = this(Error.NoCause, logSource, logClass, message, mdc, marker) } object Error { - def apply(logSource: String, logClass: Class[_], message: Any) = + def apply(logSource: String, logClass: Class[?], message: Any) = new Error(NoCause, logSource, logClass, message) - def apply(logSource: String, logClass: Class[_], message: Any, marker: LogMarker) = + def apply(logSource: String, logClass: Class[?], message: Any, marker: LogMarker) = new Error3(NoCause, logSource, logClass, message, Map.empty, marker) - def apply(cause: Throwable, logSource: String, logClass: Class[_], message: Any, mdc: MDC) = + def apply(cause: Throwable, logSource: String, logClass: Class[?], message: Any, mdc: MDC) = new Error2(cause, logSource, logClass, message, mdc) - def apply(cause: Throwable, logSource: String, logClass: Class[_], message: Any, mdc: MDC, marker: LogMarker) = + def apply(cause: Throwable, logSource: String, logClass: Class[?], message: Any, mdc: MDC, marker: LogMarker) = new Error3(cause, logSource, logClass, message, mdc, marker) - def apply(logSource: String, logClass: Class[_], message: Any, mdc: MDC) = + def apply(logSource: String, logClass: Class[?], message: Any, mdc: MDC) = new Error2(NoCause, logSource, logClass, message, mdc) - def apply(logSource: String, logClass: Class[_], message: Any, mdc: MDC, marker: LogMarker) = + def apply(logSource: String, logClass: Class[?], message: Any, mdc: MDC, marker: LogMarker) = new Error3(NoCause, logSource, logClass, message, mdc, marker) /** Null Object used for errors without cause Throwable */ @@ -862,14 +862,14 @@ object Logging { /** * For WARNING Logging */ - case class Warning(logSource: String, logClass: Class[_], message: Any = "") extends LogEvent { + case class Warning(logSource: String, logClass: Class[?], message: Any = "") extends LogEvent { override def level = WarningLevel } - class Warning2(logSource: String, logClass: Class[_], message: Any, override val mdc: MDC) + class Warning2(logSource: String, logClass: Class[?], message: Any, override val mdc: MDC) extends Warning(logSource, logClass, message) class Warning3( logSource: String, - logClass: Class[_], + logClass: Class[?], message: Any, override val mdc: MDC, override val marker: LogMarker) @@ -877,7 +877,7 @@ object Logging { with LogEventWithMarker class Warning4( logSource: String, - logClass: Class[_], + logClass: Class[?], message: Any, override val mdc: MDC, override val marker: LogMarker, @@ -886,60 +886,60 @@ object Logging { with LogEventWithMarker with LogEventWithCause object Warning { - def apply(logSource: String, logClass: Class[_], message: Any, mdc: MDC) = + def apply(logSource: String, logClass: Class[?], message: Any, mdc: MDC) = new Warning2(logSource, logClass, message, mdc) - def apply(logSource: String, logClass: Class[_], message: Any, mdc: MDC, marker: LogMarker) = + def apply(logSource: String, logClass: Class[?], message: Any, mdc: MDC, marker: LogMarker) = new Warning3(logSource, logClass, message, mdc, marker) - def apply(cause: Throwable, logSource: String, logClass: Class[_], message: Any, mdc: MDC) = + def apply(cause: Throwable, logSource: String, logClass: Class[?], message: Any, mdc: MDC) = new Warning4(logSource, logClass, message, mdc, null, cause) - def apply(cause: Throwable, logSource: String, logClass: Class[_], message: Any, mdc: MDC, marker: LogMarker) = + def apply(cause: Throwable, logSource: String, logClass: Class[?], message: Any, mdc: MDC, marker: LogMarker) = new Warning4(logSource, logClass, message, mdc, marker, cause) } /** * For INFO Logging */ - case class Info(logSource: String, logClass: Class[_], message: Any = "") extends LogEvent { + case class Info(logSource: String, logClass: Class[?], message: Any = "") extends LogEvent { override def level = InfoLevel } - class Info2(logSource: String, logClass: Class[_], message: Any, override val mdc: MDC) + class Info2(logSource: String, logClass: Class[?], message: Any, override val mdc: MDC) extends Info(logSource, logClass, message) class Info3( logSource: String, - logClass: Class[_], + logClass: Class[?], message: Any, override val mdc: MDC, override val marker: LogMarker) extends Info2(logSource, logClass, message, mdc) with LogEventWithMarker object Info { - def apply(logSource: String, logClass: Class[_], message: Any, mdc: MDC) = + def apply(logSource: String, logClass: Class[?], message: Any, mdc: MDC) = new Info2(logSource, logClass, message, mdc) - def apply(logSource: String, logClass: Class[_], message: Any, mdc: MDC, marker: LogMarker) = + def apply(logSource: String, logClass: Class[?], message: Any, mdc: MDC, marker: LogMarker) = new Info3(logSource, logClass, message, mdc, marker) } /** * For DEBUG Logging */ - case class Debug(logSource: String, logClass: Class[_], message: Any = "") extends LogEvent { + case class Debug(logSource: String, logClass: Class[?], message: Any = "") extends LogEvent { override def level = DebugLevel } - class Debug2(logSource: String, logClass: Class[_], message: Any, override val mdc: MDC) + class Debug2(logSource: String, logClass: Class[?], message: Any, override val mdc: MDC) extends Debug(logSource, logClass, message) class Debug3( logSource: String, - logClass: Class[_], + logClass: Class[?], message: Any, override val mdc: MDC, override val marker: LogMarker) extends Debug2(logSource, logClass, message, mdc) with LogEventWithMarker object Debug { - def apply(logSource: String, logClass: Class[_], message: Any, mdc: MDC) = + def apply(logSource: String, logClass: Class[?], message: Any, mdc: MDC) = new Debug2(logSource, logClass, message, mdc) - def apply(logSource: String, logClass: Class[_], message: Any, mdc: MDC, marker: LogMarker) = + def apply(logSource: String, logClass: Class[?], message: Any, mdc: MDC, marker: LogMarker) = new Debug3(logSource, logClass, message, mdc, marker) } @@ -1519,8 +1519,8 @@ trait LoggingAdapter { * there are more than four arguments. */ private def format1(t: String, arg: Any): String = arg match { - case a: Array[_] if !a.getClass.getComponentType.isPrimitive => formatImpl(t, a.toSeq) - case a: Array[_] => formatImpl(t, a.map(_.asInstanceOf[AnyRef]).toSeq) + case a: Array[?] if !a.getClass.getComponentType.isPrimitive => formatImpl(t, a.toSeq) + case a: Array[?] => formatImpl(t, a.map(_.asInstanceOf[AnyRef]).toSeq) case x => format(t, x) } @@ -1560,10 +1560,10 @@ trait LoggingAdapter { */ trait LoggingFilter { // for backward-compatibility reason implementation of method without marker only must work - def isErrorEnabled(logClass: Class[_], logSource: String): Boolean - def isWarningEnabled(logClass: Class[_], logSource: String): Boolean - def isInfoEnabled(logClass: Class[_], logSource: String): Boolean - def isDebugEnabled(logClass: Class[_], logSource: String): Boolean + def isErrorEnabled(logClass: Class[?], logSource: String): Boolean + def isWarningEnabled(logClass: Class[?], logSource: String): Boolean + def isInfoEnabled(logClass: Class[?], logSource: String): Boolean + def isDebugEnabled(logClass: Class[?], logSource: String): Boolean } /** @@ -1572,13 +1572,13 @@ trait LoggingFilter { */ @nowarn("msg=never us") trait LoggingFilterWithMarker extends LoggingFilter { - def isErrorEnabled(logClass: Class[_], logSource: String, marker: LogMarker): Boolean = + def isErrorEnabled(logClass: Class[?], logSource: String, marker: LogMarker): Boolean = isErrorEnabled(logClass, logSource) - def isWarningEnabled(logClass: Class[_], logSource: String, marker: LogMarker): Boolean = + def isWarningEnabled(logClass: Class[?], logSource: String, marker: LogMarker): Boolean = isWarningEnabled(logClass, logSource) - def isInfoEnabled(logClass: Class[_], logSource: String, marker: LogMarker): Boolean = + def isInfoEnabled(logClass: Class[?], logSource: String, marker: LogMarker): Boolean = isInfoEnabled(logClass, logSource) - def isDebugEnabled(logClass: Class[_], logSource: String, marker: LogMarker): Boolean = + def isDebugEnabled(logClass: Class[?], logSource: String, marker: LogMarker): Boolean = isDebugEnabled(logClass, logSource) } @@ -1591,13 +1591,13 @@ object LoggingFilterWithMarker { } class LoggingFilterWithMarkerWrapper(loggingFilter: LoggingFilter) extends LoggingFilterWithMarker { - override def isErrorEnabled(logClass: Class[_], logSource: String): Boolean = + override def isErrorEnabled(logClass: Class[?], logSource: String): Boolean = loggingFilter.isErrorEnabled(logClass, logSource) - override def isWarningEnabled(logClass: Class[_], logSource: String): Boolean = + override def isWarningEnabled(logClass: Class[?], logSource: String): Boolean = loggingFilter.isWarningEnabled(logClass, logSource) - override def isInfoEnabled(logClass: Class[_], logSource: String): Boolean = + override def isInfoEnabled(logClass: Class[?], logSource: String): Boolean = loggingFilter.isInfoEnabled(logClass, logSource) - override def isDebugEnabled(logClass: Class[_], logSource: String): Boolean = + override def isDebugEnabled(logClass: Class[?], logSource: String): Boolean = loggingFilter.isDebugEnabled(logClass, logSource) } @@ -1611,10 +1611,10 @@ class DefaultLoggingFilter(logLevel: () => Logging.LogLevel) extends LoggingFilt def this(settings: Settings, eventStream: EventStream) = this(() => eventStream.logLevel) import Logging._ - def isErrorEnabled(logClass: Class[_], logSource: String) = logLevel() >= ErrorLevel - def isWarningEnabled(logClass: Class[_], logSource: String) = logLevel() >= WarningLevel - def isInfoEnabled(logClass: Class[_], logSource: String) = logLevel() >= InfoLevel - def isDebugEnabled(logClass: Class[_], logSource: String) = logLevel() >= DebugLevel + def isErrorEnabled(logClass: Class[?], logSource: String) = logLevel() >= ErrorLevel + def isWarningEnabled(logClass: Class[?], logSource: String) = logLevel() >= WarningLevel + def isInfoEnabled(logClass: Class[?], logSource: String) = logLevel() >= InfoLevel + def isDebugEnabled(logClass: Class[?], logSource: String) = logLevel() >= DebugLevel } /** @@ -1743,14 +1743,14 @@ object LogMarker { class MarkerLoggingAdapter( override val bus: LoggingBus, override val logSource: String, - override val logClass: Class[_], + override val logClass: Class[?], loggingFilter: LoggingFilter) extends BusLogging(bus, logSource, logClass, loggingFilter) { // TODO when breaking binary compatibility, these marker methods should become baked into LoggingAdapter itself // For backwards compatibility, and when LoggingAdapter is created without direct // association to an ActorSystem - def this(bus: LoggingBus, logSource: String, logClass: Class[_]) = + def this(bus: LoggingBus, logSource: String, logClass: Class[?]) = this(bus, logSource, logClass, new DefaultLoggingFilter(() => bus.logLevel)) val loggingFilterWithMarker: LoggingFilterWithMarker = LoggingFilterWithMarker.wrap(loggingFilter) @@ -1998,8 +1998,8 @@ class MarkerLoggingAdapter( // Copy of LoggingAdapter.format1 due to binary compatibility restrictions private def format1(t: String, arg: Any): String = arg match { - case a: Array[_] if !a.getClass.getComponentType.isPrimitive => format(t, a.toIndexedSeq) - case a: Array[_] => format(t, a.map(_.asInstanceOf[AnyRef]).toIndexedSeq) + case a: Array[?] if !a.getClass.getComponentType.isPrimitive => format(t, a.toIndexedSeq) + case a: Array[?] => format(t, a.map(_.asInstanceOf[AnyRef]).toIndexedSeq) case x => format(t, x) } } @@ -2007,7 +2007,7 @@ class MarkerLoggingAdapter( final class DiagnosticMarkerBusLoggingAdapter( override val bus: LoggingBus, override val logSource: String, - override val logClass: Class[_], + override val logClass: Class[?], loggingFilter: LoggingFilter) extends MarkerLoggingAdapter(bus, logSource, logClass, loggingFilter) with DiagnosticLoggingAdapter @@ -2015,12 +2015,12 @@ final class DiagnosticMarkerBusLoggingAdapter( /** * [[pekko.event.LoggingAdapter]] that publishes [[pekko.event.Logging.LogEvent]] to event stream. */ -class BusLogging(val bus: LoggingBus, val logSource: String, val logClass: Class[_], loggingFilter: LoggingFilter) +class BusLogging(val bus: LoggingBus, val logSource: String, val logClass: Class[?], loggingFilter: LoggingFilter) extends LoggingAdapter { // For backwards compatibility, and when LoggingAdapter is created without direct // association to an ActorSystem - def this(bus: LoggingBus, logSource: String, logClass: Class[_]) = + def this(bus: LoggingBus, logSource: String, logClass: Class[?]) = this(bus, logSource, logClass, new DefaultLoggingFilter(() => bus.logLevel)) import Logging._ diff --git a/actor/src/main/scala/org/apache/pekko/event/jul/JavaLogger.scala b/actor/src/main/scala/org/apache/pekko/event/jul/JavaLogger.scala index 372f734dd57..607de89bca3 100644 --- a/actor/src/main/scala/org/apache/pekko/event/jul/JavaLogger.scala +++ b/actor/src/main/scala/org/apache/pekko/event/jul/JavaLogger.scala @@ -82,7 +82,7 @@ object Logger { * @param logSource - the textual representation of the source of this log stream * @return a Logger for the specified parameters */ - def apply(logClass: Class[_], logSource: String): logging.Logger = logClass match { + def apply(logClass: Class[?], logSource: String): logging.Logger = logClass match { case c if c == classOf[DummyClassForStringSources] => apply(logSource) case _ => logging.Logger.getLogger(logClass.getName) } @@ -110,12 +110,12 @@ object Logger { class JavaLoggingFilter(@unused settings: ActorSystem.Settings, eventStream: EventStream) extends LoggingFilter { import Logger.mapLevel - def isErrorEnabled(logClass: Class[_], logSource: String) = + def isErrorEnabled(logClass: Class[?], logSource: String) = (eventStream.logLevel >= ErrorLevel) && Logger(logClass, logSource).isLoggable(mapLevel(ErrorLevel)) - def isWarningEnabled(logClass: Class[_], logSource: String) = + def isWarningEnabled(logClass: Class[?], logSource: String) = (eventStream.logLevel >= WarningLevel) && Logger(logClass, logSource).isLoggable(mapLevel(WarningLevel)) - def isInfoEnabled(logClass: Class[_], logSource: String) = + def isInfoEnabled(logClass: Class[?], logSource: String) = (eventStream.logLevel >= InfoLevel) && Logger(logClass, logSource).isLoggable(mapLevel(InfoLevel)) - def isDebugEnabled(logClass: Class[_], logSource: String) = + def isDebugEnabled(logClass: Class[?], logSource: String) = (eventStream.logLevel >= DebugLevel) && Logger(logClass, logSource).isLoggable(mapLevel(DebugLevel)) } diff --git a/actor/src/main/scala/org/apache/pekko/io/DnsProvider.scala b/actor/src/main/scala/org/apache/pekko/io/DnsProvider.scala index 297f8e936c9..acbafa54748 100644 --- a/actor/src/main/scala/org/apache/pekko/io/DnsProvider.scala +++ b/actor/src/main/scala/org/apache/pekko/io/DnsProvider.scala @@ -36,12 +36,12 @@ trait DnsProvider { * DNS resolver actor. Should respond to [[pekko.io.dns.DnsProtocol.Resolve]] with * [[pekko.io.dns.DnsProtocol.Resolved]] */ - def actorClass: Class[_ <: Actor] + def actorClass: Class[? <: Actor] /** * DNS manager class. Is responsible for creating resolvers and doing any cache cleanup. * The DNS extension will create one of these Actors. It should have a ctr that accepts * a [[DnsExt]] */ - def managerClass: Class[_ <: Actor] + def managerClass: Class[? <: Actor] } diff --git a/actor/src/main/scala/org/apache/pekko/japi/JavaAPI.scala b/actor/src/main/scala/org/apache/pekko/japi/JavaAPI.scala index 8b76855170e..dd752143c89 100644 --- a/actor/src/main/scala/org/apache/pekko/japi/JavaAPI.scala +++ b/actor/src/main/scala/org/apache/pekko/japi/JavaAPI.scala @@ -255,7 +255,7 @@ object Util { * Returns an immutable.Seq representing the provided array of Classes, * an overloading of the generic immutableSeq in Util, to accommodate for erasure. */ - def immutableSeq(arr: Array[Class[_]]): immutable.Seq[Class[_]] = immutableSeq[Class[_]](arr) + def immutableSeq(arr: Array[Class[?]]): immutable.Seq[Class[?]] = immutableSeq[Class[?]](arr) /** * Turns an array into an immutable Scala sequence (by copying it). @@ -268,7 +268,7 @@ object Util { */ def immutableSeq[T](iterable: java.lang.Iterable[T]): immutable.Seq[T] = iterable match { - case imm: immutable.Seq[_] => imm.asInstanceOf[immutable.Seq[T]] + case imm: immutable.Seq[?] => imm.asInstanceOf[immutable.Seq[T]] case other => val i = other.iterator() if (i.hasNext) { diff --git a/actor/src/main/scala/org/apache/pekko/pattern/CircuitBreaker.scala b/actor/src/main/scala/org/apache/pekko/pattern/CircuitBreaker.scala index 38bf58f2739..f48c162535a 100644 --- a/actor/src/main/scala/org/apache/pekko/pattern/CircuitBreaker.scala +++ b/actor/src/main/scala/org/apache/pekko/pattern/CircuitBreaker.scala @@ -802,8 +802,8 @@ class CircuitBreaker( case _ => allowExceptions.contains(ex.getClass.getName) }) - private val failureFn: Try[_] => Boolean = { - case _: Success[_] => false + private val failureFn: Try[?] => Boolean = { + case _: Success[?] => false case Failure(t) if isIgnoredException(t) => false case _ => true } @@ -862,7 +862,7 @@ class CircuitBreaker( val f = materialize(body) f.onComplete { - case _: Success[_] => + case _: Success[?] => notifyCallSuccessListeners(start) callSucceeds() case Failure(_) => diff --git a/actor/src/main/scala/org/apache/pekko/pattern/CircuitBreakersRegistry.scala b/actor/src/main/scala/org/apache/pekko/pattern/CircuitBreakersRegistry.scala index ca4ba220453..20c8f1a514d 100644 --- a/actor/src/main/scala/org/apache/pekko/pattern/CircuitBreakersRegistry.scala +++ b/actor/src/main/scala/org/apache/pekko/pattern/CircuitBreakersRegistry.scala @@ -42,7 +42,7 @@ object CircuitBreakersRegistry extends ExtensionId[CircuitBreakersRegistry] with /** * Returns the canonical ExtensionId for this Extension */ - override def lookup: ExtensionId[_ <: Extension] = CircuitBreakersRegistry + override def lookup: ExtensionId[? <: Extension] = CircuitBreakersRegistry /** * Returns an instance of the extension identified by this ExtensionId instance. diff --git a/actor/src/main/scala/org/apache/pekko/pattern/StatusReply.scala b/actor/src/main/scala/org/apache/pekko/pattern/StatusReply.scala index e31bd108f33..1f95fbc140e 100644 --- a/actor/src/main/scala/org/apache/pekko/pattern/StatusReply.scala +++ b/actor/src/main/scala/org/apache/pekko/pattern/StatusReply.scala @@ -56,7 +56,7 @@ final class StatusReply[+T] private (private val status: Try[T]) { def isSuccess: Boolean = status.isSuccess override def equals(other: Any): Boolean = other match { - case that: StatusReply[_] => status == that.status + case that: StatusReply[?] => status == that.status case _ => false } @@ -161,7 +161,7 @@ object StatusReply { * Also note that Pekko does not contain pre-build serializers for arbitrary exceptions. */ def apply[T](exception: Throwable): StatusReply[T] = new StatusReply(ScalaFailure(exception)) - def unapply(status: StatusReply[_]): Option[Throwable] = + def unapply(status: StatusReply[?]): Option[Throwable] = if (status != null && status.isError) Some(status.getError) else None } diff --git a/actor/src/main/scala/org/apache/pekko/serialization/PrimitiveSerializers.scala b/actor/src/main/scala/org/apache/pekko/serialization/PrimitiveSerializers.scala index e256893779e..224046002ee 100644 --- a/actor/src/main/scala/org/apache/pekko/serialization/PrimitiveSerializers.scala +++ b/actor/src/main/scala/org/apache/pekko/serialization/PrimitiveSerializers.scala @@ -51,7 +51,7 @@ import pekko.util.ByteString result } - override def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = { + override def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = { var result = 0L var i = 7 while (i >= 0) { @@ -89,7 +89,7 @@ import pekko.util.ByteString result } - override def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = { + override def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = { var result = 0 var i = 3 while (i >= 0) { @@ -121,7 +121,7 @@ import pekko.util.ByteString override def toBinary(o: AnyRef): Array[Byte] = o.asInstanceOf[String].getBytes(StandardCharsets.UTF_8) - override def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = + override def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = new String(bytes, StandardCharsets.UTF_8) } @@ -154,7 +154,7 @@ import pekko.util.ByteString result } - override def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = { + override def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = { ByteString(bytes) } @@ -204,7 +204,7 @@ import pekko.util.ByteString result } - override def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = { + override def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = { bytes(0) match { case TrueB => TRUE case FalseB => FALSE diff --git a/actor/src/main/scala/org/apache/pekko/serialization/Serialization.scala b/actor/src/main/scala/org/apache/pekko/serialization/Serialization.scala index e1c45503723..8c87732156f 100644 --- a/actor/src/main/scala/org/apache/pekko/serialization/Serialization.scala +++ b/actor/src/main/scala/org/apache/pekko/serialization/Serialization.scala @@ -40,7 +40,7 @@ object Serialization { /** * Tuple that represents mapping from Class to Serializer */ - type ClassSerializer = (Class[_], Serializer) + type ClassSerializer = (Class[?], Serializer) /** * INTERNAL API: This holds a reference to the current transport serialization information used for @@ -153,7 +153,7 @@ class Serialization(val system: ExtendedActorSystem) extends Extension { private[this] val _log = Logging.withMarker(system, getClass.getName) val log: LoggingAdapter = _log - private val manifestCache = new AtomicReference[Map[String, Option[Class[_]]]](Map.empty[String, Option[Class[_]]]) + private val manifestCache = new AtomicReference[Map[String, Option[Class[?]]]](Map.empty[String, Option[Class[?]]]) /** INTERNAL API */ @InternalApi private[pekko] def serializationInformation: Serialization.Information = @@ -184,7 +184,7 @@ class Serialization(val system: ExtendedActorSystem) extends Extension { * Returns either the resulting object or an Exception if one was thrown. */ @deprecated("Use deserialize that accepts the `manifest` as a class name.", since = "Akka 2.6.0") - def deserialize[T](bytes: Array[Byte], serializerId: Int, clazz: Option[Class[_ <: T]]): Try[T] = + def deserialize[T](bytes: Array[Byte], serializerId: Int, clazz: Option[Class[? <: T]]): Try[T] = Try { val serializer = try getSerializerById(serializerId) @@ -220,7 +220,7 @@ class Serialization(val system: ExtendedActorSystem) extends Extension { private def deserializeByteArray(bytes: Array[Byte], serializer: Serializer, manifest: String): AnyRef = { - @tailrec def updateCache(cache: Map[String, Option[Class[_]]], key: String, value: Option[Class[_]]): Boolean = { + @tailrec def updateCache(cache: Map[String, Option[Class[?]]], key: String, value: Option[Class[?]]): Boolean = { manifestCache.compareAndSet(cache, cache.updated(key, value)) || updateCache(manifestCache.get, key, value) // recursive, try again } @@ -238,7 +238,7 @@ class Serialization(val system: ExtendedActorSystem) extends Extension { case None => system.dynamicAccess.getClassFor[AnyRef](manifest) match { case Success(classManifest) => - val classManifestOption: Option[Class[_]] = Some(classManifest) + val classManifestOption: Option[Class[?]] = Some(classManifest) updateCache(cache, manifest, classManifestOption) s1.fromBinary(bytes, classManifestOption) case Failure(_) => @@ -314,10 +314,10 @@ class Serialization(val system: ExtendedActorSystem) extends Extension { * Throws java.io.NotSerializableException if no `serialization-bindings` is configured for the class. */ @throws(classOf[NotSerializableException]) - def serializerFor(clazz: Class[_]): Serializer = + def serializerFor(clazz: Class[?]): Serializer = serializerMap.get(clazz) match { case null => // bindings are ordered from most specific to least specific - def unique(possibilities: immutable.Seq[(Class[_], Serializer)]): Boolean = + def unique(possibilities: immutable.Seq[(Class[?], Serializer)]): Boolean = possibilities.size == 1 || (possibilities.forall(_._1.isAssignableFrom(possibilities(0)._1))) || (possibilities.forall(_._2 == possibilities(0)._2)) @@ -466,7 +466,7 @@ class Serialization(val system: ExtendedActorSystem) extends Extension { } } - private def warnUnexpectedNonPekkoSerializer(clazz: Class[_], ser: Serializer): Boolean = { + private def warnUnexpectedNonPekkoSerializer(clazz: Class[?], ser: Serializer): Boolean = { if (clazz.getName.startsWith("org.apache.pekko.") && !ser.getClass.getName.startsWith("org.apache.pekko.")) { log.warning( "Using serializer [{}] for message [{}]. Note that this serializer " + @@ -506,8 +506,8 @@ class Serialization(val system: ExtendedActorSystem) extends Extension { * serializerMap is a Map whose keys is the class that is serializable and values is the serializer * to be used for that class. */ - private val serializerMap: ConcurrentHashMap[Class[_], Serializer] = - bindings.foldLeft(new ConcurrentHashMap[Class[_], Serializer]) { case (map, (c, s)) => map.put(c, s); map } + private val serializerMap: ConcurrentHashMap[Class[?], Serializer] = + bindings.foldLeft(new ConcurrentHashMap[Class[?], Serializer]) { case (map, (c, s)) => map.put(c, s); map } /** * Maps from a Serializer Identity (Int) to a Serializer instance (optimization) @@ -565,9 +565,9 @@ class Serialization(val system: ExtendedActorSystem) extends Extension { /** * INTERNAL API */ - @InternalApi private[pekko] def shouldWarnAboutJavaSerializer(serializedClass: Class[_], serializer: Serializer) = { + @InternalApi private[pekko] def shouldWarnAboutJavaSerializer(serializedClass: Class[?], serializer: Serializer) = { - def suppressWarningOnNonSerializationVerification(serializedClass: Class[_]) = { + def suppressWarningOnNonSerializationVerification(serializedClass: Class[?]) = { // suppressed, only when warn-on-no-serialization-verification = off, and extending NoSerializationVerificationNeeded !isWarningOnNoVerificationEnabled && classOf[NoSerializationVerificationNeeded].isAssignableFrom(serializedClass) } diff --git a/actor/src/main/scala/org/apache/pekko/serialization/SerializationSetup.scala b/actor/src/main/scala/org/apache/pekko/serialization/SerializationSetup.scala index 1057f4758e8..20c3bf2b517 100644 --- a/actor/src/main/scala/org/apache/pekko/serialization/SerializationSetup.scala +++ b/actor/src/main/scala/org/apache/pekko/serialization/SerializationSetup.scala @@ -55,7 +55,7 @@ object SerializerDetails { * @param useFor A set of classes or superclasses to bind to the serializer, selection works just as if * the classes, the alias and the serializer had been in the config. */ - def apply(alias: String, serializer: Serializer, useFor: immutable.Seq[Class[_]]): SerializerDetails = + def apply(alias: String, serializer: Serializer, useFor: immutable.Seq[Class[?]]): SerializerDetails = new SerializerDetails(alias, serializer, useFor) /** @@ -65,7 +65,7 @@ object SerializerDetails { * @param useFor A set of classes or superclasses to bind to the serializer, selection works just as if * the classes, the alias and the serializer had been in the config. */ - def create(alias: String, serializer: Serializer, useFor: java.util.List[Class[_]]): SerializerDetails = + def create(alias: String, serializer: Serializer, useFor: java.util.List[Class[?]]): SerializerDetails = apply(alias, serializer, useFor.asScala.toVector) } @@ -77,4 +77,4 @@ object SerializerDetails { final class SerializerDetails private ( val alias: String, val serializer: Serializer, - val useFor: immutable.Seq[Class[_]]) + val useFor: immutable.Seq[Class[?]]) diff --git a/actor/src/main/scala/org/apache/pekko/serialization/Serializer.scala b/actor/src/main/scala/org/apache/pekko/serialization/Serializer.scala index de8fc3943f4..acfe3df739b 100644 --- a/actor/src/main/scala/org/apache/pekko/serialization/Serializer.scala +++ b/actor/src/main/scala/org/apache/pekko/serialization/Serializer.scala @@ -74,7 +74,7 @@ trait Serializer { * the class should be loaded using ActorSystem.dynamicAccess. */ @throws(classOf[NotSerializableException]) - def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef + def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef /** * Java API: deserialize without type hint @@ -85,7 +85,7 @@ trait Serializer { * Java API: deserialize with type hint */ @throws(classOf[NotSerializableException]) - final def fromBinary(bytes: Array[Byte], clazz: Class[_]): AnyRef = fromBinary(bytes, Option(clazz)) + final def fromBinary(bytes: Array[Byte], clazz: Class[?]): AnyRef = fromBinary(bytes, Option(clazz)) } object Serializers { @@ -163,7 +163,7 @@ abstract class SerializerWithStringManifest extends Serializer { @throws(classOf[NotSerializableException]) def fromBinary(bytes: Array[Byte], manifest: String): AnyRef - final def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = { + final def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = { val manifestString = manifest match { case Some(c) => c.getName case None => "" @@ -274,7 +274,7 @@ object BaseSerializer { /** INTERNAL API */ @InternalApi - private[pekko] def identifierFromConfig(clazz: Class[_], system: ExtendedActorSystem): Int = + private[pekko] def identifierFromConfig(clazz: Class[?], system: ExtendedActorSystem): Int = system.settings.config.getInt(s"""$SerializationIdentifiers."${clazz.getName}"""") /** INTERNAL API */ @@ -292,13 +292,13 @@ object BaseSerializer { abstract class JSerializer extends Serializer { @throws(classOf[NotSerializableException]) - final def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = + final def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = fromBinaryJava(bytes, manifest.orNull) /** * This method must be implemented, manifest may be null. */ - protected def fromBinaryJava(bytes: Array[Byte], manifest: Class[_]): AnyRef + protected def fromBinaryJava(bytes: Array[Byte], manifest: Class[?]): AnyRef } object NullSerializer extends NullSerializer @@ -353,7 +353,7 @@ class JavaSerializer(val system: ExtendedActorSystem) extends BaseSerializer { } @throws(classOf[NotSerializableException]) - def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = { + def fromBinary(bytes: Array[Byte], clazz: Option[Class[?]]): AnyRef = { val in = new ClassLoaderObjectInputStream(system.dynamicAccess.classLoader, new ByteArrayInputStream(bytes)) val obj = JavaSerializer.currentSystem.withValue(system) { in.readObject } in.close() @@ -386,7 +386,7 @@ final case class DisabledJavaSerializer(system: ExtendedActorSystem) extends Ser } @throws(classOf[NotSerializableException]) - override def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = { + override def fromBinary(bytes: Array[Byte], clazz: Option[Class[?]]): AnyRef = { log.warning( LogMarker.Security, "Incoming message attempted to use Java Serialization even though `pekko.actor.allow-java-serialization = off` was set!") @@ -426,7 +426,7 @@ class NullSerializer extends Serializer { def identifier = 0 def toBinary(o: AnyRef): Array[Byte] = nullAsBytes @throws(classOf[NotSerializableException]) - def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = null + def fromBinary(bytes: Array[Byte], clazz: Option[Class[?]]): AnyRef = null } /** @@ -445,7 +445,7 @@ class ByteArraySerializer(val system: ExtendedActorSystem) extends BaseSerialize } @throws(classOf[NotSerializableException]) - def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = bytes + def fromBinary(bytes: Array[Byte], clazz: Option[Class[?]]): AnyRef = bytes override def toBinary(o: AnyRef, buf: ByteBuffer): Unit = o match { diff --git a/actor/src/main/scala/org/apache/pekko/util/BoundedBlockingQueue.scala b/actor/src/main/scala/org/apache/pekko/util/BoundedBlockingQueue.scala index dc16c346e6d..4f0c3df9c92 100644 --- a/actor/src/main/scala/org/apache/pekko/util/BoundedBlockingQueue.scala +++ b/actor/src/main/scala/org/apache/pekko/util/BoundedBlockingQueue.scala @@ -30,11 +30,11 @@ class BoundedBlockingQueue[E <: AnyRef](val maxCapacity: Int, private val backin backing match { case null => throw new IllegalArgumentException("Backing Queue may not be null") - case b: BlockingQueue[_] => + case b: BlockingQueue[?] => require(maxCapacity > 0) require(b.size() == 0) require(b.remainingCapacity >= maxCapacity) - case b: Queue[_] => + case b: Queue[?] => require(b.size() == 0) require(maxCapacity > 0) } @@ -186,9 +186,9 @@ class BoundedBlockingQueue[E <: AnyRef](val maxCapacity: Int, private val backin finally lock.unlock() } - def drainTo(c: Collection[_ >: E]): Int = drainTo(c, Int.MaxValue) + def drainTo(c: Collection[? >: E]): Int = drainTo(c, Int.MaxValue) - def drainTo(c: Collection[_ >: E], maxElements: Int): Int = { + def drainTo(c: Collection[? >: E], maxElements: Int): Int = { if (c eq null) throw new NullPointerException if (c eq this) throw new IllegalArgumentException if (c eq backing) throw new IllegalArgumentException @@ -211,13 +211,13 @@ class BoundedBlockingQueue[E <: AnyRef](val maxCapacity: Int, private val backin } } - override def containsAll(c: Collection[_]): Boolean = { + override def containsAll(c: Collection[?]): Boolean = { lock.lock() try backing.containsAll(c) finally lock.unlock() } - override def removeAll(c: Collection[_]): Boolean = { + override def removeAll(c: Collection[?]): Boolean = { lock.lock() try { if (backing.removeAll(c)) { @@ -229,7 +229,7 @@ class BoundedBlockingQueue[E <: AnyRef](val maxCapacity: Int, private val backin } finally lock.unlock() } - override def retainAll(c: Collection[_]): Boolean = { + override def retainAll(c: Collection[?]): Boolean = { lock.lock() try { if (backing.retainAll(c)) { diff --git a/actor/src/main/scala/org/apache/pekko/util/BoxedType.scala b/actor/src/main/scala/org/apache/pekko/util/BoxedType.scala index e26094214d0..0e7fc097548 100644 --- a/actor/src/main/scala/org/apache/pekko/util/BoxedType.scala +++ b/actor/src/main/scala/org/apache/pekko/util/BoxedType.scala @@ -16,7 +16,7 @@ package org.apache.pekko.util object BoxedType { import java.{ lang => jl } - private val toBoxed = Map[Class[_], Class[_]]( + private val toBoxed = Map[Class[?], Class[?]]( classOf[Boolean] -> classOf[jl.Boolean], classOf[Byte] -> classOf[jl.Byte], classOf[Char] -> classOf[jl.Character], @@ -27,5 +27,5 @@ object BoxedType { classOf[Double] -> classOf[jl.Double], classOf[Unit] -> classOf[scala.runtime.BoxedUnit]) - final def apply(c: Class[_]): Class[_] = if (c.isPrimitive) toBoxed(c) else c + final def apply(c: Class[?]): Class[?] = if (c.isPrimitive) toBoxed(c) else c } diff --git a/actor/src/main/scala/org/apache/pekko/util/ClassLoaderObjectInputStream.scala b/actor/src/main/scala/org/apache/pekko/util/ClassLoaderObjectInputStream.scala index ed35147fa3e..b5a6f66a8df 100644 --- a/actor/src/main/scala/org/apache/pekko/util/ClassLoaderObjectInputStream.scala +++ b/actor/src/main/scala/org/apache/pekko/util/ClassLoaderObjectInputStream.scala @@ -23,7 +23,7 @@ import java.io.{ InputStream, ObjectInputStream, ObjectStreamClass } * @param is - the InputStream that is wrapped */ class ClassLoaderObjectInputStream(classLoader: ClassLoader, is: InputStream) extends ObjectInputStream(is) { - override protected def resolveClass(objectStreamClass: ObjectStreamClass): Class[_] = + override protected def resolveClass(objectStreamClass: ObjectStreamClass): Class[?] = try Class.forName(objectStreamClass.getName, false, classLoader) catch { case _: ClassNotFoundException => super.resolveClass(objectStreamClass) diff --git a/actor/src/main/scala/org/apache/pekko/util/LineNumbers.scala b/actor/src/main/scala/org/apache/pekko/util/LineNumbers.scala index 648d790ed9a..2faa74b00de 100644 --- a/actor/src/main/scala/org/apache/pekko/util/LineNumbers.scala +++ b/actor/src/main/scala/org/apache/pekko/util/LineNumbers.scala @@ -196,7 +196,7 @@ object LineNumbers { } } - private def getStreamForClass(c: Class[_]): Option[(InputStream, None.type)] = { + private def getStreamForClass(c: Class[?]): Option[(InputStream, None.type)] = { val resource = c.getName.replace('.', '/') + ".class" val cl = c.getClassLoader val r = cl.getResourceAsStream(resource) diff --git a/actor/src/main/scala/org/apache/pekko/util/Reflect.scala b/actor/src/main/scala/org/apache/pekko/util/Reflect.scala index 2450e895cdd..baa95779f77 100644 --- a/actor/src/main/scala/org/apache/pekko/util/Reflect.scala +++ b/actor/src/main/scala/org/apache/pekko/util/Reflect.scala @@ -40,11 +40,11 @@ private[pekko] object Reflect { * * Hint: when comparing to Thread.currentThread().getStackTrace, add two levels. */ - val getCallerClass: Option[Int => Class[_]] = { + val getCallerClass: Option[Int => Class[?]] = { try { val c = Class.forName("sun.reflect.Reflection") val m = c.getMethod("getCallerClass", Array(classOf[Int]): _*) - Some((i: Int) => m.invoke(null, Array[AnyRef](i.asInstanceOf[java.lang.Integer]): _*).asInstanceOf[Class[_]]) + Some((i: Int) => m.invoke(null, Array[AnyRef](i.asInstanceOf[java.lang.Integer]): _*).asInstanceOf[Class[?]]) } catch { case NonFatal(_) => None } @@ -123,7 +123,7 @@ private[pekko] object Reflect { else constructor } - private def safeGetClass(a: Any): Class[_] = + private def safeGetClass(a: Any): Class[?] = if (a == null) classOf[AnyRef] else a.getClass /** @@ -133,17 +133,17 @@ private[pekko] object Reflect { */ private[pekko] def instantiator[T](clazz: Class[T]): () => T = () => instantiate(clazz) - def findMarker(root: Class[_], marker: Class[_]): Type = { - @tailrec def rec(curr: Class[_]): Type = { + def findMarker(root: Class[?], marker: Class[?]): Type = { + @tailrec def rec(curr: Class[?]): Type = { if (curr.getSuperclass != null && marker.isAssignableFrom(curr.getSuperclass)) rec(curr.getSuperclass) else curr.getGenericInterfaces.collectFirst { - case c: Class[_] if marker.isAssignableFrom(c) => c - case t: ParameterizedType if marker.isAssignableFrom(t.getRawType.asInstanceOf[Class[_]]) => t + case c: Class[?] if marker.isAssignableFrom(c) => c + case t: ParameterizedType if marker.isAssignableFrom(t.getRawType.asInstanceOf[Class[?]]) => t } match { case None => throw new IllegalArgumentException(s"cannot find [$marker] in ancestors of [$root]") - case Some(c: Class[_]) => if (c == marker) c else rec(c) - case Some(t: ParameterizedType) => if (t.getRawType == marker) t else rec(t.getRawType.asInstanceOf[Class[_]]) + case Some(c: Class[?]) => if (c == marker) c else rec(c) + case Some(t: ParameterizedType) => if (t.getRawType == marker) t else rec(t.getRawType.asInstanceOf[Class[?]]) case _ => ??? // cannot happen due to collectFirst } } @@ -154,7 +154,7 @@ private[pekko] object Reflect { * INTERNAL API */ private[pekko] def findClassLoader(): ClassLoader = { - def findCaller(get: Int => Class[_]): ClassLoader = + def findCaller(get: Int => Class[?]): ClassLoader = Iterator .from(2 /*is the magic number, promise*/ ) .map(get) diff --git a/actor/src/main/scala/org/apache/pekko/util/TypedMultiMap.scala b/actor/src/main/scala/org/apache/pekko/util/TypedMultiMap.scala index c22e603ab29..cedfa41980e 100644 --- a/actor/src/main/scala/org/apache/pekko/util/TypedMultiMap.scala +++ b/actor/src/main/scala/org/apache/pekko/util/TypedMultiMap.scala @@ -109,7 +109,7 @@ class TypedMultiMap[T <: AnyRef, K[_ <: T]] private (private val map: Map[T, Set override def toString: String = s"TypedMultiMap($map)" override def equals(other: Any) = other match { - case o: TypedMultiMap[_, _] => map == o.map + case o: TypedMultiMap[?, ?] => map == o.map case _ => false } override def hashCode: Int = map.hashCode diff --git a/bench-jmh/src/main/scala/org/apache/pekko/actor/typed/TypedBenchmarkActors.scala b/bench-jmh/src/main/scala/org/apache/pekko/actor/typed/TypedBenchmarkActors.scala index 1d0eaf9fa2b..d82be1a9c19 100644 --- a/bench-jmh/src/main/scala/org/apache/pekko/actor/typed/TypedBenchmarkActors.scala +++ b/bench-jmh/src/main/scala/org/apache/pekko/actor/typed/TypedBenchmarkActors.scala @@ -161,7 +161,7 @@ object TypedBenchmarkActors { } private def startPingPongActorPairs( - ctx: ActorContext[_], + ctx: ActorContext[?], messagesPerPair: Int, numPairs: Int, dispatcher: String): (Vector[(ActorRef[Message], ActorRef[Message])], CountDownLatch) = { diff --git a/bench-jmh/src/main/scala/org/apache/pekko/remote/artery/CodecBenchmark.scala b/bench-jmh/src/main/scala/org/apache/pekko/remote/artery/CodecBenchmark.scala index a1cb3a85619..3ff7e067788 100644 --- a/bench-jmh/src/main/scala/org/apache/pekko/remote/artery/CodecBenchmark.scala +++ b/bench-jmh/src/main/scala/org/apache/pekko/remote/artery/CodecBenchmark.scala @@ -294,7 +294,7 @@ object CodecBenchmark { override def toBinary(o: AnyRef): Array[Byte] = Preserialized - override def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = + override def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = fromBinary(ByteBuffer.wrap(bytes), "NoManifestForYou") } diff --git a/bench-jmh/src/main/scala/org/apache/pekko/stream/FlowMapBenchmark.scala b/bench-jmh/src/main/scala/org/apache/pekko/stream/FlowMapBenchmark.scala index 5ab9a14c9f8..e4e9141034b 100644 --- a/bench-jmh/src/main/scala/org/apache/pekko/stream/FlowMapBenchmark.scala +++ b/bench-jmh/src/main/scala/org/apache/pekko/stream/FlowMapBenchmark.scala @@ -110,7 +110,7 @@ class FlowMapBenchmark { } // source setup - private def mkMaps[O, Mat](source: Source[O, Mat], count: Int)(flow: => Graph[FlowShape[O, O], _]): Source[O, Mat] = { + private def mkMaps[O, Mat](source: Source[O, Mat], count: Int)(flow: => Graph[FlowShape[O, O], ?]): Source[O, Mat] = { var f = source for (_ <- 1 to count) f = f.via(flow) diff --git a/bench-jmh/src/main/scala/org/apache/pekko/util/StackBench.scala b/bench-jmh/src/main/scala/org/apache/pekko/util/StackBench.scala index 3120124ac5d..16296dc2a74 100644 --- a/bench-jmh/src/main/scala/org/apache/pekko/util/StackBench.scala +++ b/bench-jmh/src/main/scala/org/apache/pekko/util/StackBench.scala @@ -22,7 +22,7 @@ import org.openjdk.jmh.annotations.{ Benchmark, Measurement, Scope, State } class StackBench { class CustomSecurtyManager extends SecurityManager { - def getTrace: Array[Class[_]] = + def getTrace: Array[Class[?]] = getClassContext } @@ -32,7 +32,7 @@ class StackBench { } @Benchmark - def securityManager(): Array[Class[_]] = { + def securityManager(): Array[Class[?]] = { (new CustomSecurtyManager).getTrace } diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ClusterShardingQuery.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ClusterShardingQuery.scala index 3373754f7a8..54e99bc4843 100644 --- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ClusterShardingQuery.scala +++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ClusterShardingQuery.scala @@ -36,7 +36,7 @@ sealed trait ClusterShardingQuery * * For the statistics for the entire cluster, see [[GetClusterShardingStats]]. */ -final case class GetShardRegionState(entityTypeKey: EntityTypeKey[_], replyTo: ActorRef[CurrentShardRegionState]) +final case class GetShardRegionState(entityTypeKey: EntityTypeKey[?], replyTo: ActorRef[CurrentShardRegionState]) extends ClusterShardingQuery { /** @@ -45,7 +45,7 @@ final case class GetShardRegionState(entityTypeKey: EntityTypeKey[_], replyTo: A * Query the ShardRegion state for the given entity type key. This will get the state of the * local ShardRegion's state. */ - def this(entityTypeKey: javadsl.EntityTypeKey[_], replyTo: ActorRef[CurrentShardRegionState]) = + def this(entityTypeKey: javadsl.EntityTypeKey[?], replyTo: ActorRef[CurrentShardRegionState]) = this(entityTypeKey.asScala, replyTo) } @@ -61,7 +61,7 @@ final case class GetShardRegionState(entityTypeKey: EntityTypeKey[_], replyTo: A * @param replyTo the actor to send the result to */ final case class GetClusterShardingStats( - entityTypeKey: EntityTypeKey[_], + entityTypeKey: EntityTypeKey[?], timeout: FiniteDuration, replyTo: ActorRef[ClusterShardingStats]) extends ClusterShardingQuery { @@ -74,7 +74,7 @@ final case class GetClusterShardingStats( * shard regions the reply will contain an empty map of regions. */ def this( - entityTypeKey: javadsl.EntityTypeKey[_], + entityTypeKey: javadsl.EntityTypeKey[?], timeout: java.time.Duration, replyTo: ActorRef[ClusterShardingStats]) = this(entityTypeKey.asScala, JavaDurationConverters.asFiniteDuration(timeout), replyTo) diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ClusterShardingSettings.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ClusterShardingSettings.scala index 5b8d0b08406..3088eb43ed1 100644 --- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ClusterShardingSettings.scala +++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ClusterShardingSettings.scala @@ -34,7 +34,7 @@ import pekko.util.JavaDurationConverters._ object ClusterShardingSettings { /** Scala API: Creates new cluster sharding settings object */ - def apply(system: ActorSystem[_]): ClusterShardingSettings = + def apply(system: ActorSystem[?]): ClusterShardingSettings = fromConfig(system.settings.config.getConfig("pekko.cluster.sharding")) def fromConfig(config: Config): ClusterShardingSettings = { @@ -44,7 +44,7 @@ object ClusterShardingSettings { } /** Java API: Creates new cluster sharding settings object */ - def create(system: ActorSystem[_]): ClusterShardingSettings = + def create(system: ActorSystem[?]): ClusterShardingSettings = apply(system) /** INTERNAL API: Intended only for internal use, it is not recommended to keep converting between the setting types */ diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ReplicatedShardingExtension.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ReplicatedShardingExtension.scala index 9a21c890793..ddbdef76be7 100644 --- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ReplicatedShardingExtension.scala +++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ReplicatedShardingExtension.scala @@ -29,10 +29,10 @@ import java.util.{ Map => JMap } */ object ReplicatedShardingExtension extends ExtensionId[ReplicatedShardingExtension] { - override def createExtension(system: ActorSystem[_]): ReplicatedShardingExtension = + override def createExtension(system: ActorSystem[?]): ReplicatedShardingExtension = new ReplicatedShardingExtensionImpl(system) - def get(system: ActorSystem[_]): ReplicatedShardingExtension = apply(system) + def get(system: ActorSystem[?]): ReplicatedShardingExtension = apply(system) } diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ShardedDaemonProcessSettings.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ShardedDaemonProcessSettings.scala index 40f97680bbf..d8f103bcaf7 100644 --- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ShardedDaemonProcessSettings.scala +++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ShardedDaemonProcessSettings.scala @@ -27,12 +27,12 @@ import pekko.util.JavaDurationConverters._ object ShardedDaemonProcessSettings { /** Scala API: Create default settings for system */ - def apply(system: ActorSystem[_]): ShardedDaemonProcessSettings = { + def apply(system: ActorSystem[?]): ShardedDaemonProcessSettings = { fromConfig(system.settings.config.getConfig("pekko.cluster.sharded-daemon-process")) } /** Java API: Create default settings for system */ - def create(system: ActorSystem[_]): ShardedDaemonProcessSettings = + def create(system: ActorSystem[?]): ShardedDaemonProcessSettings = apply(system) /** diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/delivery/ShardingConsumerController.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/delivery/ShardingConsumerController.scala index 1e58675bc00..6257b2c4b14 100644 --- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/delivery/ShardingConsumerController.scala +++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/delivery/ShardingConsumerController.scala @@ -55,7 +55,7 @@ object ShardingConsumerController { * Scala API: Factory method from config `pekko.reliable-delivery.sharding.consumer-controller` * of the `ActorSystem`. */ - def apply(system: ActorSystem[_]): Settings = + def apply(system: ActorSystem[?]): Settings = apply(system.settings.config.getConfig("pekko.reliable-delivery.sharding.consumer-controller")) /** @@ -70,7 +70,7 @@ object ShardingConsumerController { * Java API: Factory method from config `pekko.reliable-delivery.sharding.consumer-controller` * of the `ActorSystem`. */ - def create(system: ActorSystem[_]): Settings = + def create(system: ActorSystem[?]): Settings = apply(system) /** diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/delivery/ShardingProducerController.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/delivery/ShardingProducerController.scala index b38d954277d..7b973cc6209 100644 --- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/delivery/ShardingProducerController.scala +++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/delivery/ShardingProducerController.scala @@ -175,7 +175,7 @@ object ShardingProducerController { * Scala API: Factory method from config `pekko.reliable-delivery.sharding.producer-controller` * of the `ActorSystem`. */ - def apply(system: ActorSystem[_]): Settings = + def apply(system: ActorSystem[?]): Settings = apply(system.settings.config.getConfig("pekko.reliable-delivery.sharding.producer-controller")) /** @@ -195,7 +195,7 @@ object ShardingProducerController { * Java API: Factory method from config `pekko.reliable-delivery.sharding.producer-controller` * of the `ActorSystem`. */ - def create(system: ActorSystem[_]): Settings = + def create(system: ActorSystem[?]): Settings = apply(system) /** diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/delivery/internal/ShardingConsumerControllerImpl.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/delivery/internal/ShardingConsumerControllerImpl.scala index adf156f918a..3e85591e2a2 100644 --- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/delivery/internal/ShardingConsumerControllerImpl.scala +++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/delivery/internal/ShardingConsumerControllerImpl.scala @@ -46,7 +46,7 @@ import pekko.cluster.sharding.typed.delivery.ShardingConsumerController private def waitForStart[A]( context: ActorContext[ConsumerController.Command[A]], settings: ShardingConsumerController.Settings, - consumer: ActorRef[_]): Behavior[ConsumerController.Command[A]] = { + consumer: ActorRef[?]): Behavior[ConsumerController.Command[A]] = { Behaviors.withStash(settings.bufferSize) { stashBuffer => Behaviors .receiveMessage[ConsumerController.Command[A]] { 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 a559895c800..676ab3750a1 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 @@ -100,14 +100,14 @@ import pekko.util.JavaDurationConverters._ } /** INTERNAL API */ -@InternalApi private[pekko] final class ClusterShardingImpl(system: ActorSystem[_]) +@InternalApi private[pekko] final class ClusterShardingImpl(system: ActorSystem[?]) extends javadsl.ClusterSharding with scaladsl.ClusterSharding { import pekko.actor.typed.scaladsl.adapter._ require( - system.isInstanceOf[ActorSystemAdapter[_]], + system.isInstanceOf[ActorSystemAdapter[?]], "only adapted classic actor systems can be used for cluster features") private val cluster = Cluster(system) @@ -333,7 +333,7 @@ import pekko.util.JavaDurationConverters._ override def equals(other: Any): Boolean = other match { - case eri: EntityRefImpl[_] => + case eri: EntityRefImpl[?] => (eri.entityId == entityId) && (eri.typeKey == typeKey) && (eri.dataCenter == dataCenter) @@ -412,13 +412,13 @@ import pekko.util.JavaDurationConverters._ // impl InternalRecipientRef override def provider: ActorRefProvider = { import pekko.actor.typed.scaladsl.adapter._ - shardRegion.toTyped.asInstanceOf[InternalRecipientRef[_]].provider + shardRegion.toTyped.asInstanceOf[InternalRecipientRef[?]].provider } // impl InternalRecipientRef def isTerminated: Boolean = { import pekko.actor.typed.scaladsl.adapter._ - shardRegion.toTyped.asInstanceOf[InternalRecipientRef[_]].isTerminated + shardRegion.toTyped.asInstanceOf[InternalRecipientRef[?]].isTerminated } override def toString: String = s"EntityRef($typeKey, $entityId)" @@ -440,7 +440,7 @@ import pekko.util.JavaDurationConverters._ import pekko.cluster.sharding.ShardRegion.{ Passivate => ClassicPassivate } def behavior(stopMessage: Any): Behavior[scaladsl.ClusterSharding.ShardCommand] = { - def sendClassicPassivate(entity: ActorRef[_], ctx: TypedActorContext[_]): Unit = { + def sendClassicPassivate(entity: ActorRef[?], ctx: TypedActorContext[?]): Unit = { val pathToShard = entity.toClassic.path.elements.take(4).mkString("/") ctx.asScala.system.toClassic.actorSelection(pathToShard).tell(ClassicPassivate(stopMessage), entity.toClassic) } diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ReplicatedShardingExtensionImpl.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ReplicatedShardingExtensionImpl.scala index 8a64289d245..a8cfa055a4f 100644 --- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ReplicatedShardingExtensionImpl.scala +++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ReplicatedShardingExtensionImpl.scala @@ -37,7 +37,7 @@ import pekko.util.ccompat.JavaConverters._ * INTERNAL API */ @InternalApi -private[pekko] final class ReplicatedShardingExtensionImpl(system: ActorSystem[_]) extends ReplicatedShardingExtension { +private[pekko] final class ReplicatedShardingExtensionImpl(system: ActorSystem[?]) extends ReplicatedShardingExtension { private val counter = new AtomicLong(0) diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ShardedDaemonProcessImpl.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ShardedDaemonProcessImpl.scala index 9107e1eede0..15d579fd6b9 100644 --- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ShardedDaemonProcessImpl.scala +++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ShardedDaemonProcessImpl.scala @@ -101,7 +101,7 @@ private[pekko] object ShardedDaemonProcessImpl { * INTERNAL API */ @InternalApi -private[pekko] final class ShardedDaemonProcessImpl(system: ActorSystem[_]) +private[pekko] final class ShardedDaemonProcessImpl(system: ActorSystem[?]) extends javadsl.ShardedDaemonProcess with scaladsl.ShardedDaemonProcess { diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ShardingSerializer.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ShardingSerializer.scala index a9bcbdf6c4e..7b33f741208 100644 --- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ShardingSerializer.scala +++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ShardingSerializer.scala @@ -39,13 +39,13 @@ import java.nio.ByteBuffer private val ShardingEnvelopeManifest = "a" override def manifest(o: AnyRef): String = o match { - case _: ShardingEnvelope[_] => ShardingEnvelopeManifest + case _: ShardingEnvelope[?] => ShardingEnvelopeManifest case _ => throw new IllegalArgumentException(s"Can't serialize object of type ${o.getClass} in [${getClass.getName}]") } override def toBinary(o: AnyRef): Array[Byte] = o match { - case env: ShardingEnvelope[_] => + case env: ShardingEnvelope[?] => val builder = ShardingMessages.ShardingEnvelope.newBuilder() builder.setEntityId(env.entityId) builder.setMessage(payloadSupport.payloadBuilder(env.message)) @@ -68,7 +68,7 @@ import java.nio.ByteBuffer // buffer based avoiding a copy for artery override def toBinary(o: AnyRef, buf: ByteBuffer): Unit = o match { - case env: ShardingEnvelope[_] => + case env: ShardingEnvelope[?] => val builder = ShardingMessages.ShardingEnvelope.newBuilder() builder.setEntityId(env.entityId) builder.setMessage(payloadSupport.payloadBuilder(env.message)) diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/testkit/TestEntityRefImpl.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/testkit/TestEntityRefImpl.scala index 06d4b36fbaf..f777cc63b54 100644 --- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/testkit/TestEntityRefImpl.scala +++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/testkit/TestEntityRefImpl.scala @@ -67,12 +67,12 @@ import pekko.util.Timeout // impl InternalRecipientRef override def provider: ActorRefProvider = { - probe.asInstanceOf[InternalRecipientRef[_]].provider + probe.asInstanceOf[InternalRecipientRef[?]].provider } // impl InternalRecipientRef def isTerminated: Boolean = { - probe.asInstanceOf[InternalRecipientRef[_]].isTerminated + probe.asInstanceOf[InternalRecipientRef[?]].isTerminated } override def toString: String = s"TestEntityRef($entityId)" 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 450a075e580..bf168445cfe 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 @@ -40,7 +40,7 @@ trait EntityFactory[M] { } object ClusterSharding { - def get(system: ActorSystem[_]): ClusterSharding = + def get(system: ActorSystem[?]): ClusterSharding = scaladsl.ClusterSharding(system).asJava /** diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/javadsl/ShardedDaemonProcess.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/javadsl/ShardedDaemonProcess.scala index 8389e1c5c39..d6000db4974 100644 --- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/javadsl/ShardedDaemonProcess.scala +++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/javadsl/ShardedDaemonProcess.scala @@ -24,7 +24,7 @@ import pekko.cluster.sharding.ShardCoordinator.ShardAllocationStrategy import pekko.cluster.sharding.typed.ShardedDaemonProcessSettings object ShardedDaemonProcess { - def get(system: ActorSystem[_]): ShardedDaemonProcess = + def get(system: ActorSystem[?]): ShardedDaemonProcess = pekko.cluster.sharding.typed.scaladsl.ShardedDaemonProcess(system).asJava } diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/scaladsl/ClusterSharding.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/scaladsl/ClusterSharding.scala index ed1908bd7e0..181c70f0195 100644 --- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/scaladsl/ClusterSharding.scala +++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/scaladsl/ClusterSharding.scala @@ -38,7 +38,7 @@ import pekko.util.Timeout object ClusterSharding extends ExtensionId[ClusterSharding] { - override def createExtension(system: ActorSystem[_]): ClusterSharding = + override def createExtension(system: ActorSystem[?]): ClusterSharding = new ClusterShardingImpl(system) /** @@ -538,7 +538,7 @@ object EntityTypeKey { } object ClusterShardingSetup { - def apply[T <: Extension](createExtension: ActorSystem[_] => ClusterSharding): ClusterShardingSetup = + def apply[T <: Extension](createExtension: ActorSystem[?] => ClusterSharding): ClusterShardingSetup = new ClusterShardingSetup(createExtension(_)) } @@ -548,5 +548,5 @@ object ClusterShardingSetup { * to replace the default implementation of the [[ClusterSharding]] extension. Intended * for tests that need to replace extension with stub/mock implementations. */ -final class ClusterShardingSetup(createExtension: java.util.function.Function[ActorSystem[_], ClusterSharding]) +final class ClusterShardingSetup(createExtension: java.util.function.Function[ActorSystem[?], ClusterSharding]) extends ExtensionSetup[ClusterSharding](ClusterSharding, createExtension) diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/scaladsl/ShardedDaemonProcess.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/scaladsl/ShardedDaemonProcess.scala index 1e30bb4fb65..2fc1064771e 100644 --- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/scaladsl/ShardedDaemonProcess.scala +++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/scaladsl/ShardedDaemonProcess.scala @@ -28,7 +28,7 @@ import pekko.cluster.sharding.typed.internal.ShardedDaemonProcessImpl import pekko.cluster.sharding.typed.javadsl object ShardedDaemonProcess extends ExtensionId[ShardedDaemonProcess] { - override def createExtension(system: ActorSystem[_]): ShardedDaemonProcess = new ShardedDaemonProcessImpl(system) + override def createExtension(system: ActorSystem[?]): ShardedDaemonProcess = new ShardedDaemonProcessImpl(system) } /** diff --git a/cluster-sharding-typed/src/test/scala/docs/org/apache/pekko/cluster/sharding/typed/DurableStateStoreQueryUsageCompileOnlySpec.scala b/cluster-sharding-typed/src/test/scala/docs/org/apache/pekko/cluster/sharding/typed/DurableStateStoreQueryUsageCompileOnlySpec.scala index c43d3134699..9fe939082c2 100644 --- a/cluster-sharding-typed/src/test/scala/docs/org/apache/pekko/cluster/sharding/typed/DurableStateStoreQueryUsageCompileOnlySpec.scala +++ b/cluster-sharding-typed/src/test/scala/docs/org/apache/pekko/cluster/sharding/typed/DurableStateStoreQueryUsageCompileOnlySpec.scala @@ -35,7 +35,7 @@ object DurableStateStoreQueryUsageCompileOnlySpec { val source: Source[DurableStateChange[Record], NotUsed] = durableStateStoreQuery.changes("tag", offset) source.map { case UpdatedDurableState(persistenceId, revision, value, offset, timestamp) => Some(value) - case _: DeletedDurableState[_] => None + case _: DeletedDurableState[?] => None } // #get-durable-state-store-query-example } diff --git a/cluster-sharding-typed/src/test/scala/docs/org/apache/pekko/cluster/sharding/typed/ExternalShardAllocationCompileOnlySpec.scala b/cluster-sharding-typed/src/test/scala/docs/org/apache/pekko/cluster/sharding/typed/ExternalShardAllocationCompileOnlySpec.scala index d858752310b..cb2312532a5 100644 --- a/cluster-sharding-typed/src/test/scala/docs/org/apache/pekko/cluster/sharding/typed/ExternalShardAllocationCompileOnlySpec.scala +++ b/cluster-sharding-typed/src/test/scala/docs/org/apache/pekko/cluster/sharding/typed/ExternalShardAllocationCompileOnlySpec.scala @@ -30,7 +30,7 @@ import docs.org.apache.pekko.cluster.sharding.typed.ShardingCompileOnlySpec.Basi import scala.concurrent.Future class ExternalShardAllocationCompileOnlySpec { - val system: ActorSystem[_] = ??? + val system: ActorSystem[?] = ??? val sharding = ClusterSharding(system) diff --git a/cluster-sharding-typed/src/test/scala/docs/org/apache/pekko/cluster/sharding/typed/HelloWorldPersistentEntityExample.scala b/cluster-sharding-typed/src/test/scala/docs/org/apache/pekko/cluster/sharding/typed/HelloWorldPersistentEntityExample.scala index e91e122428c..5091dd5bfc8 100644 --- a/cluster-sharding-typed/src/test/scala/docs/org/apache/pekko/cluster/sharding/typed/HelloWorldPersistentEntityExample.scala +++ b/cluster-sharding-typed/src/test/scala/docs/org/apache/pekko/cluster/sharding/typed/HelloWorldPersistentEntityExample.scala @@ -32,7 +32,7 @@ object HelloWorldPersistentEntityExample { import pekko.cluster.sharding.typed.scaladsl.Entity import pekko.util.Timeout - class HelloWorldService(system: ActorSystem[_]) { + class HelloWorldService(system: ActorSystem[?]) { import system.executionContext private val sharding = ClusterSharding(system) diff --git a/cluster-sharding-typed/src/test/scala/docs/org/apache/pekko/cluster/sharding/typed/ReplicatedShardingCompileOnlySpec.scala b/cluster-sharding-typed/src/test/scala/docs/org/apache/pekko/cluster/sharding/typed/ReplicatedShardingCompileOnlySpec.scala index 5145b0370b5..28984bccd8f 100644 --- a/cluster-sharding-typed/src/test/scala/docs/org/apache/pekko/cluster/sharding/typed/ReplicatedShardingCompileOnlySpec.scala +++ b/cluster-sharding-typed/src/test/scala/docs/org/apache/pekko/cluster/sharding/typed/ReplicatedShardingCompileOnlySpec.scala @@ -31,7 +31,7 @@ object ReplicatedShardingCompileOnlySpec { sealed trait Command - val system: ActorSystem[_] = ??? + val system: ActorSystem[?] = ??? object MyEventSourcedBehavior { def apply(replicationId: ReplicationId): Behavior[Command] = ??? diff --git a/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/JoinConfigCompatCheckerClusterShardingSpec.scala b/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/JoinConfigCompatCheckerClusterShardingSpec.scala index b2b8183ec75..05460c833e9 100644 --- a/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/JoinConfigCompatCheckerClusterShardingSpec.scala +++ b/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/JoinConfigCompatCheckerClusterShardingSpec.scala @@ -61,10 +61,10 @@ class JoinConfigCompatCheckerClusterShardingSpec private val clusterWaitDuration = 5.seconds - private def configured(system: ActorSystem[_]): Int = + private def configured(system: ActorSystem[?]): Int = system.settings.config.getInt(Key) - private def join(sys: ActorSystem[_]): ClassicCluster = { + private def join(sys: ActorSystem[?]): ClassicCluster = { if (sys eq system) { configured(system) should ===(Shards) val seedNode = ClassicCluster(system) diff --git a/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/ReplicatedShardingSpec.scala b/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/ReplicatedShardingSpec.scala index 13354dd9810..04c5a39f2a2 100644 --- a/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/ReplicatedShardingSpec.scala +++ b/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/ReplicatedShardingSpec.scala @@ -264,7 +264,7 @@ abstract class ReplicatedShardingSpec(replicationType: ReplicationType, configA: } "start replicated sharding on both nodes" in { - def start(sys: ActorSystem[_]) = { + def start(sys: ActorSystem[?]) = { ReplicatedShardingExtension(sys).init(MyReplicatedStringSet.provider(replicationType)) ReplicatedShardingExtension(sys).init(MyReplicatedIntSet.provider(replicationType)) } diff --git a/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/delivery/DurableShardingSpec.scala b/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/delivery/DurableShardingSpec.scala index 42331cb7309..535c5c1fa84 100644 --- a/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/delivery/DurableShardingSpec.scala +++ b/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/delivery/DurableShardingSpec.scala @@ -114,7 +114,7 @@ class DurableShardingSpec (1 to 4).foreach { n => producerProbe.receiveMessage().sendNextTo ! ShardingEnvelope("entity-1", TestConsumer.Job(s"msg-$n")) journalOperations.expectMessageType[InmemJournal.Write].event.getClass should ===( - classOf[DurableProducerQueue.MessageSent[_]]) + classOf[DurableProducerQueue.MessageSent[?]]) } journalOperations.expectNoMessage() @@ -183,7 +183,7 @@ class DurableShardingSpec val next5 = producerProbe.receiveMessage() next5.sendNextTo ! ShardingEnvelope("entity-1", TestConsumer.Job(s"msg-5")) journalOperations.expectMessageType[InmemJournal.Write].event.getClass should ===( - classOf[DurableProducerQueue.MessageSent[_]]) + classOf[DurableProducerQueue.MessageSent[?]]) // issue #30489: the consumer controller may have stopped after msg-5, so allow for resend on timeout (10-15s) val delivery5 = consumerProbe.receiveMessage(20.seconds) @@ -225,7 +225,7 @@ class DurableShardingSpec TestConsumer.Job(s"msg-1"), replyProbe.ref) journalOperations.expectMessageType[InmemJournal.Write].event.getClass should ===( - classOf[DurableProducerQueue.MessageSent[_]]) + classOf[DurableProducerQueue.MessageSent[?]]) replyProbe.expectMessage(Done) producerProbe.receiveMessage().askNextTo ! MessageWithConfirmation( @@ -233,7 +233,7 @@ class DurableShardingSpec TestConsumer.Job(s"msg-2"), replyProbe.ref) journalOperations.expectMessageType[InmemJournal.Write].event.getClass should ===( - classOf[DurableProducerQueue.MessageSent[_]]) + classOf[DurableProducerQueue.MessageSent[?]]) replyProbe.expectMessage(Done) testKit.stop(shardingProducerController) diff --git a/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/scaladsl/ClusterShardingPersistenceSpec.scala b/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/scaladsl/ClusterShardingPersistenceSpec.scala index 7f8cd731978..9fb95817742 100644 --- a/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/scaladsl/ClusterShardingPersistenceSpec.scala +++ b/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/scaladsl/ClusterShardingPersistenceSpec.scala @@ -166,7 +166,7 @@ class ClusterShardingPersistenceSpec _entityId.toString } - private def awaitEntityTerminatedAndRemoved(ref: ActorRef[_], entityId: String): Unit = { + private def awaitEntityTerminatedAndRemoved(ref: ActorRef[?], entityId: String): Unit = { val p = TestProbe[Any]() p.expectTerminated(ref, p.remainingOrDefault) diff --git a/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/ShardingFlightRecorder.scala b/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/ShardingFlightRecorder.scala index 29bb1a6c771..52bd659492a 100644 --- a/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/ShardingFlightRecorder.scala +++ b/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/ShardingFlightRecorder.scala @@ -23,7 +23,7 @@ import pekko.util.FlightRecorderLoader @InternalApi object ShardingFlightRecorder extends ExtensionId[ShardingFlightRecorder] with ExtensionIdProvider { - override def lookup: ExtensionId[_ <: Extension] = this + override def lookup: ExtensionId[? <: Extension] = this override def createExtension(system: ExtendedActorSystem): ShardingFlightRecorder = FlightRecorderLoader.load[ShardingFlightRecorder]( diff --git a/cluster-sharding/src/multi-jvm/scala/org/apache/pekko/cluster/sharding/MultiNodeClusterShardingConfig.scala b/cluster-sharding/src/multi-jvm/scala/org/apache/pekko/cluster/sharding/MultiNodeClusterShardingConfig.scala index e49a149dd4a..5ffe060a55f 100644 --- a/cluster-sharding/src/multi-jvm/scala/org/apache/pekko/cluster/sharding/MultiNodeClusterShardingConfig.scala +++ b/cluster-sharding/src/multi-jvm/scala/org/apache/pekko/cluster/sharding/MultiNodeClusterShardingConfig.scala @@ -24,7 +24,7 @@ import pekko.remote.testkit.MultiNodeConfig object MultiNodeClusterShardingConfig { - private[sharding] def testNameFromCallStack(classToStartFrom: Class[_]): String = { + private[sharding] def testNameFromCallStack(classToStartFrom: Class[?]): String = { def isAbstractClass(className: String): Boolean = { try { diff --git a/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/ShardingQueriesSpec.scala b/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/ShardingQueriesSpec.scala index 112b32ef170..01dd8006cb3 100644 --- a/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/ShardingQueriesSpec.scala +++ b/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/ShardingQueriesSpec.scala @@ -27,13 +27,13 @@ class ShardingQueriesSpec extends PekkoSpec { "ShardsQueryResult" must { - def nonEmpty(qr: ShardsQueryResult[_]): Boolean = + def nonEmpty(qr: ShardsQueryResult[?]): Boolean = qr.total > 0 && qr.queried > 0 - def isTotalFailed(qr: ShardsQueryResult[_]): Boolean = + def isTotalFailed(qr: ShardsQueryResult[?]): Boolean = nonEmpty(qr) && qr.failed.size == qr.total - def isAllSubsetFailed(qr: ShardsQueryResult[_]): Boolean = + def isAllSubsetFailed(qr: ShardsQueryResult[?]): Boolean = nonEmpty(qr) && qr.queried < qr.total && qr.failed.size == qr.queried "reflect nothing to acquire metadata from - 0 shards" in { diff --git a/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/internal/ReplicatorBehavior.scala b/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/internal/ReplicatorBehavior.scala index 06b670ec689..a999f76d87c 100644 --- a/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/internal/ReplicatorBehavior.scala +++ b/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/internal/ReplicatorBehavior.scala @@ -76,7 +76,7 @@ import pekko.util.Timeout Behaviors .receive[SReplicator.Command] { (ctx, msg) => msg match { - case cmd: SReplicator.Get[_] => + case cmd: SReplicator.Get[?] => classicReplicator.tell(dd.Replicator.Get(cmd.key, cmd.consistency), sender = cmd.replyTo.toClassic) Behaviors.same @@ -102,7 +102,7 @@ import pekko.util.Timeout reply.foreach { cmd.replyTo ! _ } Behaviors.same - case cmd: SReplicator.Update[_] => + case cmd: SReplicator.Update[?] => classicReplicator.tell( dd.Replicator.Update(cmd.key, cmd.writeConsistency, None)(cmd.modify), sender = cmd.replyTo.toClassic) @@ -131,7 +131,7 @@ import pekko.util.Timeout reply.foreach { cmd.replyTo ! _ } Behaviors.same - case cmd: SReplicator.Subscribe[_] => + case cmd: SReplicator.Subscribe[?] => // For the Scala API the SubscribeResponse messages can be sent directly to the subscriber classicReplicator.tell( dd.Replicator.Subscribe(cmd.key, cmd.subscriber.toClassic), @@ -157,12 +157,12 @@ import pekko.util.Timeout case InternalSubscribeResponse(rsp, subscriber) => rsp match { - case chg: dd.Replicator.Changed[_] => subscriber ! JReplicator.Changed(chg.key)(chg.dataValue) - case del: dd.Replicator.Deleted[_] => subscriber ! JReplicator.Deleted(del.key) + case chg: dd.Replicator.Changed[?] => subscriber ! JReplicator.Changed(chg.key)(chg.dataValue) + case del: dd.Replicator.Deleted[?] => subscriber ! JReplicator.Deleted(del.key) } Behaviors.same - case cmd: SReplicator.Unsubscribe[_] => + case cmd: SReplicator.Unsubscribe[?] => classicReplicator.tell( dd.Replicator.Unsubscribe(cmd.key, cmd.subscriber.toClassic), sender = cmd.subscriber.toClassic) @@ -171,7 +171,7 @@ import pekko.util.Timeout case cmd: JReplicator.Unsubscribe[ReplicatedData] @unchecked => stopSubscribeAdapter(cmd.subscriber) - case cmd: SReplicator.Delete[_] => + case cmd: SReplicator.Delete[?] => classicReplicator.tell(dd.Replicator.Delete(cmd.key, cmd.consistency), sender = cmd.replyTo.toClassic) Behaviors.same diff --git a/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/javadsl/DistributedData.scala b/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/javadsl/DistributedData.scala index 7c8ce8400ac..b1421d4328c 100644 --- a/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/javadsl/DistributedData.scala +++ b/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/javadsl/DistributedData.scala @@ -30,9 +30,9 @@ import pekko.cluster.ddata.SelfUniqueAddress import pekko.util.JavaDurationConverters._ object DistributedData extends ExtensionId[DistributedData] { - def get(system: ActorSystem[_]): DistributedData = apply(system) + def get(system: ActorSystem[?]): DistributedData = apply(system) - override def createExtension(system: ActorSystem[_]): DistributedData = + override def createExtension(system: ActorSystem[?]): DistributedData = new DistributedDataImpl(system) /** @@ -97,7 +97,7 @@ abstract class DistributedData extends Extension { /** * INTERNAL API */ -@InternalApi private[pekko] class DistributedDataImpl(system: ActorSystem[_]) extends DistributedData { +@InternalApi private[pekko] class DistributedDataImpl(system: ActorSystem[?]) extends DistributedData { override val replicator: ActorRef[Replicator.Command] = pekko.cluster.ddata.typed.scaladsl.DistributedData(system).replicator.narrow[Replicator.Command] @@ -108,7 +108,7 @@ abstract class DistributedData extends Extension { } object DistributedDataSetup { - def apply[T <: Extension](createExtension: ActorSystem[_] => DistributedData): DistributedDataSetup = + def apply[T <: Extension](createExtension: ActorSystem[?] => DistributedData): DistributedDataSetup = new DistributedDataSetup(createExtension(_)) } @@ -118,5 +118,5 @@ object DistributedDataSetup { * to replace the default implementation of the [[DistributedData]] extension. Intended * for tests that need to replace extension with stub/mock implementations. */ -final class DistributedDataSetup(createExtension: java.util.function.Function[ActorSystem[_], DistributedData]) +final class DistributedDataSetup(createExtension: java.util.function.Function[ActorSystem[?], DistributedData]) extends ExtensionSetup[DistributedData](DistributedData, createExtension) diff --git a/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/javadsl/ReplicatorSettings.scala b/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/javadsl/ReplicatorSettings.scala index 4370d150877..dfd3ae0f1e4 100644 --- a/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/javadsl/ReplicatorSettings.scala +++ b/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/javadsl/ReplicatorSettings.scala @@ -26,7 +26,7 @@ object ReplicatorSettings { * Create settings from the default configuration * `pekko.cluster.distributed-data`. */ - def create(system: ActorSystem[_]): dd.ReplicatorSettings = + def create(system: ActorSystem[?]): dd.ReplicatorSettings = dd.ReplicatorSettings(system.toClassic) /** diff --git a/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/scaladsl/DistributedData.scala b/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/scaladsl/DistributedData.scala index b3ef6aaf697..7fc3435f9d1 100644 --- a/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/scaladsl/DistributedData.scala +++ b/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/scaladsl/DistributedData.scala @@ -31,9 +31,9 @@ import pekko.cluster.ddata.SelfUniqueAddress import pekko.util.JavaDurationConverters._ object DistributedData extends ExtensionId[DistributedData] { - def get(system: ActorSystem[_]): DistributedData = apply(system) + def get(system: ActorSystem[?]): DistributedData = apply(system) - override def createExtension(system: ActorSystem[_]): DistributedData = + override def createExtension(system: ActorSystem[?]): DistributedData = new DistributedData(system) /** @@ -76,7 +76,7 @@ object DistributedData extends ExtensionId[DistributedData] { * [[pekko.cluster.ddata.DistributedData]] and that means that typed * and classic actors can share the same data. */ -class DistributedData(system: ActorSystem[_]) extends Extension { +class DistributedData(system: ActorSystem[?]) extends Extension { import pekko.actor.typed.scaladsl.adapter._ private val settings: ReplicatorSettings = ReplicatorSettings(system) diff --git a/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/scaladsl/ReplicatorSettings.scala b/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/scaladsl/ReplicatorSettings.scala index aa0449d9db0..4d2450ef1be 100644 --- a/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/scaladsl/ReplicatorSettings.scala +++ b/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/scaladsl/ReplicatorSettings.scala @@ -30,7 +30,7 @@ object ReplicatorSettings { * Create settings from the default configuration * `pekko.cluster.distributed-data`. */ - def apply(system: ActorSystem[_]): ReplicatorSettings = + def apply(system: ActorSystem[?]): ReplicatorSettings = dd.ReplicatorSettings(system.toClassic) /** @@ -44,6 +44,6 @@ object ReplicatorSettings { * INTERNAL API * The name of the actor used in DistributedData extensions. */ - @InternalApi private[pekko] def name(system: ActorSystem[_]): String = + @InternalApi private[pekko] def name(system: ActorSystem[?]): String = dd.ReplicatorSettings.name(system.toClassic, Some("typed")) } diff --git a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/Cluster.scala b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/Cluster.scala index e2fdf08a765..3ae85e751e6 100644 --- a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/Cluster.scala +++ b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/Cluster.scala @@ -185,12 +185,12 @@ case object PrepareForFullClusterShutdown extends PrepareForFullClusterShutdown */ object Cluster extends ExtensionId[Cluster] { - def createExtension(system: ActorSystem[_]): Cluster = new AdapterClusterImpl(system) + def createExtension(system: ActorSystem[?]): Cluster = new AdapterClusterImpl(system) /** * Java API */ - def get(system: ActorSystem[_]): Cluster = apply(system) + def get(system: ActorSystem[?]): Cluster = apply(system) } /** @@ -223,7 +223,7 @@ abstract class Cluster extends Extension { } object ClusterSetup { - def apply[T <: Extension](createExtension: ActorSystem[_] => Cluster): ClusterSetup = + def apply[T <: Extension](createExtension: ActorSystem[?] => Cluster): ClusterSetup = new ClusterSetup(createExtension(_)) } @@ -233,5 +233,5 @@ object ClusterSetup { * to replace the default implementation of the [[Cluster]] extension. Intended * for tests that need to replace extension with stub/mock implementations. */ -final class ClusterSetup(createExtension: java.util.function.Function[ActorSystem[_], Cluster]) +final class ClusterSetup(createExtension: java.util.function.Function[ActorSystem[?], Cluster]) extends ExtensionSetup[Cluster](Cluster, createExtension) diff --git a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/ClusterSingleton.scala b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/ClusterSingleton.scala index 92e2cbbcfeb..dd556c95c4a 100644 --- a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/ClusterSingleton.scala +++ b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/ClusterSingleton.scala @@ -29,13 +29,13 @@ import pekko.util.JavaDurationConverters._ import com.typesafe.config.Config object ClusterSingletonSettings { - def apply(system: ActorSystem[_]): ClusterSingletonSettings = + def apply(system: ActorSystem[?]): ClusterSingletonSettings = fromConfig(system.settings.config.getConfig("pekko.cluster")) /** * Java API */ - def create(system: ActorSystem[_]): ClusterSingletonSettings = apply(system) + def create(system: ActorSystem[?]): ClusterSingletonSettings = apply(system) def fromConfig(config: Config): ClusterSingletonSettings = { // TODO introduce a config namespace for typed singleton and read that? @@ -144,12 +144,12 @@ final class ClusterSingletonSettings( object ClusterSingleton extends ExtensionId[ClusterSingleton] { - override def createExtension(system: ActorSystem[_]): ClusterSingleton = new AdaptedClusterSingletonImpl(system) + override def createExtension(system: ActorSystem[?]): ClusterSingleton = new AdaptedClusterSingletonImpl(system) /** * Java API: */ - def get(system: ActorSystem[_]): ClusterSingleton = apply(system) + def get(system: ActorSystem[?]): ClusterSingleton = apply(system) } /** @@ -236,7 +236,7 @@ object ClusterSingletonManagerSettings { * Create settings from the default configuration * `pekko.cluster.singleton`. */ - def apply(system: ActorSystem[_]): ClusterSingletonManagerSettings = + def apply(system: ActorSystem[?]): ClusterSingletonManagerSettings = apply(system.settings.config.getConfig("pekko.cluster.singleton")) .withRemovalMargin(pekko.cluster.Cluster(system).downingProvider.downRemovalMargin) @@ -262,7 +262,7 @@ object ClusterSingletonManagerSettings { * Java API: Create settings from the default configuration * `pekko.cluster.singleton`. */ - def create(system: ActorSystem[_]): ClusterSingletonManagerSettings = apply(system) + def create(system: ActorSystem[?]): ClusterSingletonManagerSettings = apply(system) /** * Java API: Create settings from a configuration with the same layout as @@ -343,7 +343,7 @@ final class ClusterSingletonManagerSettings( } object ClusterSingletonSetup { - def apply[T <: Extension](createExtension: ActorSystem[_] => ClusterSingleton): ClusterSingletonSetup = + def apply[T <: Extension](createExtension: ActorSystem[?] => ClusterSingleton): ClusterSingletonSetup = new ClusterSingletonSetup(createExtension(_)) } @@ -353,5 +353,5 @@ object ClusterSingletonSetup { * to replace the default implementation of the [[ClusterSingleton]] extension. Intended * for tests that need to replace extension with stub/mock implementations. */ -final class ClusterSingletonSetup(createExtension: java.util.function.Function[ActorSystem[_], ClusterSingleton]) +final class ClusterSingletonSetup(createExtension: java.util.function.Function[ActorSystem[?], ClusterSingleton]) extends ExtensionSetup[ClusterSingleton](ClusterSingleton, createExtension) diff --git a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/AdaptedClusterImpl.scala b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/AdaptedClusterImpl.scala index 9ed646b668b..90edbe23897 100644 --- a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/AdaptedClusterImpl.scala +++ b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/AdaptedClusterImpl.scala @@ -155,10 +155,10 @@ private[pekko] object AdapterClusterImpl { * INTERNAL API: */ @InternalApi -private[pekko] final class AdapterClusterImpl(system: ActorSystem[_]) extends Cluster { +private[pekko] final class AdapterClusterImpl(system: ActorSystem[?]) extends Cluster { import AdapterClusterImpl._ - require(system.isInstanceOf[ActorSystemAdapter[_]], "only adapted actor systems can be used for cluster features") + require(system.isInstanceOf[ActorSystemAdapter[?]], "only adapted actor systems can be used for cluster features") private val classicCluster = pekko.cluster.Cluster(system) override def selfMember: Member = classicCluster.selfMember diff --git a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/AdaptedClusterSingletonImpl.scala b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/AdaptedClusterSingletonImpl.scala index 6d67d706711..032400e67d8 100644 --- a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/AdaptedClusterSingletonImpl.scala +++ b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/AdaptedClusterSingletonImpl.scala @@ -32,9 +32,9 @@ import pekko.cluster.typed.{ Cluster, ClusterSingleton, ClusterSingletonImpl, Cl * INTERNAL API: */ @InternalApi -private[pekko] final class AdaptedClusterSingletonImpl(system: ActorSystem[_]) extends ClusterSingleton { +private[pekko] final class AdaptedClusterSingletonImpl(system: ActorSystem[?]) extends ClusterSingleton { require( - system.isInstanceOf[ActorSystemAdapter[_]], + system.isInstanceOf[ActorSystemAdapter[?]], "only adapted actor systems can be used for the typed cluster singleton") import ClusterSingletonImpl._ @@ -44,7 +44,7 @@ private[pekko] final class AdaptedClusterSingletonImpl(system: ActorSystem[_]) e private lazy val cluster = Cluster(system) private val classicSystem = system.toClassic.asInstanceOf[ExtendedActorSystem] - private val proxies = new ConcurrentHashMap[(String, Option[DataCenter]), ActorRef[_]]() + private val proxies = new ConcurrentHashMap[(String, Option[DataCenter]), ActorRef[?]]() override def init[M](singleton: typed.SingletonActor[M]): ActorRef[M] = { val settings = singleton.settings match { @@ -79,8 +79,8 @@ private[pekko] final class AdaptedClusterSingletonImpl(system: ActorSystem[_]) e } private def getProxy[T](name: String, settings: ClusterSingletonSettings): ActorRef[T] = { - val proxyCreator = new JFunction[(String, Option[DataCenter]), ActorRef[_]] { - def apply(singletonNameAndDc: (String, Option[DataCenter])): ActorRef[_] = { + val proxyCreator = new JFunction[(String, Option[DataCenter]), ActorRef[?]] { + def apply(singletonNameAndDc: (String, Option[DataCenter])): ActorRef[?] = { val (singletonName, _) = singletonNameAndDc val proxyName = s"singletonProxy$singletonName-${settings.dataCenter.getOrElse("no-dc")}" classicSystem.systemActorOf( diff --git a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/PekkoClusterTypedSerializer.scala b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/PekkoClusterTypedSerializer.scala index f813179af76..967a688007e 100644 --- a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/PekkoClusterTypedSerializer.scala +++ b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/PekkoClusterTypedSerializer.scala @@ -43,14 +43,14 @@ private[pekko] final class PekkoClusterTypedSerializer(override val system: Exte override def manifest(o: AnyRef): String = o match { case _: Entry => ReceptionistEntryManifest - case _: TopicImpl.MessagePublished[_] => PubSubPublishManifest + case _: TopicImpl.MessagePublished[?] => PubSubPublishManifest case _ => throw new IllegalArgumentException(s"Can't serialize object of type ${o.getClass} in [${getClass.getName}]") } override def toBinary(o: AnyRef): Array[Byte] = o match { case e: Entry => receptionistEntryToBinary(e) - case m: TopicImpl.MessagePublished[_] => pubSubPublishToBinary(m) + case m: TopicImpl.MessagePublished[?] => pubSubPublishToBinary(m) case _ => throw new IllegalArgumentException(s"Cannot serialize object of type [${o.getClass.getName}]") } @@ -63,7 +63,7 @@ private[pekko] final class PekkoClusterTypedSerializer(override val system: Exte s"Unimplemented deserialization of message with manifest [$manifest] in [${getClass.getName}]") } - private def pubSubPublishToBinary(m: TopicImpl.MessagePublished[_]): Array[Byte] = { + private def pubSubPublishToBinary(m: TopicImpl.MessagePublished[?]): Array[Byte] = { ClusterMessages.PubSubMessagePublished .newBuilder() .setMessage(payloadSupport.payloadBuilder(m.message)) @@ -83,7 +83,7 @@ private[pekko] final class PekkoClusterTypedSerializer(override val system: Exte b.build().toByteArray } - private def pubSubMessageFromBinary(bytes: Array[Byte]): TopicImpl.MessagePublished[_] = { + private def pubSubMessageFromBinary(bytes: Array[Byte]): TopicImpl.MessagePublished[?] = { val parsed = ClusterMessages.PubSubMessagePublished.parseFrom(bytes) val userMessage = payloadSupport.deserializePayload(parsed.getMessage) TopicImpl.MessagePublished(userMessage) diff --git a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/delivery/ReliableDeliverySerializer.scala b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/delivery/ReliableDeliverySerializer.scala index a1b8b5fe906..fdcb8919b86 100644 --- a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/delivery/ReliableDeliverySerializer.scala +++ b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/delivery/ReliableDeliverySerializer.scala @@ -58,34 +58,34 @@ import pekko.remote.ByteStringUtils private val DurableQueueCleanupManifest = "i" override def manifest(o: AnyRef): String = o match { - case _: ConsumerController.SequencedMessage[_] => SequencedMessageManifest + case _: ConsumerController.SequencedMessage[?] => SequencedMessageManifest case _: ProducerControllerImpl.Ack => AckManifest case _: ProducerControllerImpl.Request => RequestManifest case _: ProducerControllerImpl.Resend => ResendManifest - case _: ProducerController.RegisterConsumer[_] => RegisterConsumerManifest - case _: DurableProducerQueue.MessageSent[_] => DurableQueueMessageSentManifest + case _: ProducerController.RegisterConsumer[?] => RegisterConsumerManifest + case _: DurableProducerQueue.MessageSent[?] => DurableQueueMessageSentManifest case _: DurableProducerQueue.Confirmed => DurableQueueConfirmedManifest - case _: DurableProducerQueue.State[_] => DurableQueueStateManifest + case _: DurableProducerQueue.State[?] => DurableQueueStateManifest case _: DurableProducerQueue.Cleanup => DurableQueueCleanupManifest case _ => throw new IllegalArgumentException(s"Can't serialize object of type ${o.getClass} in [${getClass.getName}]") } override def toBinary(o: AnyRef): Array[Byte] = o match { - case m: ConsumerController.SequencedMessage[_] => sequencedMessageToBinary(m) + case m: ConsumerController.SequencedMessage[?] => sequencedMessageToBinary(m) case m: ProducerControllerImpl.Ack => ackToBinary(m) case m: ProducerControllerImpl.Request => requestToBinary(m) case m: ProducerControllerImpl.Resend => resendToBinary(m) - case m: ProducerController.RegisterConsumer[_] => registerConsumerToBinary(m) - case m: DurableProducerQueue.MessageSent[_] => durableQueueMessageSentToBinary(m) + case m: ProducerController.RegisterConsumer[?] => registerConsumerToBinary(m) + case m: DurableProducerQueue.MessageSent[?] => durableQueueMessageSentToBinary(m) case m: DurableProducerQueue.Confirmed => durableQueueConfirmedToBinary(m) - case m: DurableProducerQueue.State[_] => durableQueueStateToBinary(m) + case m: DurableProducerQueue.State[?] => durableQueueStateToBinary(m) case m: DurableProducerQueue.Cleanup => durableQueueCleanupToBinary(m) case _ => throw new IllegalArgumentException(s"Cannot serialize object of type [${o.getClass.getName}]") } - private def sequencedMessageToBinary(m: ConsumerController.SequencedMessage[_]): Array[Byte] = { + private def sequencedMessageToBinary(m: ConsumerController.SequencedMessage[?]): Array[Byte] = { val b = ReliableDelivery.SequencedMessage.newBuilder() b.setProducerId(m.producerId) b.setSeqNr(m.seqNr) @@ -134,17 +134,17 @@ import pekko.remote.ByteStringUtils b.build().toByteArray() } - private def registerConsumerToBinary(m: ProducerController.RegisterConsumer[_]): Array[Byte] = { + private def registerConsumerToBinary(m: ProducerController.RegisterConsumer[?]): Array[Byte] = { val b = ReliableDelivery.RegisterConsumer.newBuilder() b.setConsumerControllerRef(resolver.toSerializationFormat(m.consumerController)) b.build().toByteArray() } - private def durableQueueMessageSentToBinary(m: DurableProducerQueue.MessageSent[_]): Array[Byte] = { + private def durableQueueMessageSentToBinary(m: DurableProducerQueue.MessageSent[?]): Array[Byte] = { durableQueueMessageSentToProto(m).toByteArray() } - private def durableQueueMessageSentToProto(m: DurableProducerQueue.MessageSent[_]): ReliableDelivery.MessageSent = { + private def durableQueueMessageSentToProto(m: DurableProducerQueue.MessageSent[?]): ReliableDelivery.MessageSent = { val b = ReliableDelivery.MessageSent.newBuilder() b.setSeqNr(m.seqNr) b.setQualifier(m.confirmationQualifier) @@ -178,7 +178,7 @@ import pekko.remote.ByteStringUtils b.build() } - private def durableQueueStateToBinary(m: DurableProducerQueue.State[_]): Array[Byte] = { + private def durableQueueStateToBinary(m: DurableProducerQueue.State[?]): Array[Byte] = { val b = ReliableDelivery.State.newBuilder() b.setCurrentSeqNr(m.currentSeqNr) b.setHighestConfirmedSeqNr(m.highestConfirmedSeqNr) diff --git a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/receptionist/ClusterReceptionist.scala b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/receptionist/ClusterReceptionist.scala index 5eed8a4be7d..0de09cc0d8b 100644 --- a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/receptionist/ClusterReceptionist.scala +++ b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/receptionist/ClusterReceptionist.scala @@ -54,15 +54,15 @@ private[typed] object ClusterReceptionist extends ReceptionistBehaviorProvider { import ClusterReceptionistProtocol.SubscriptionsKV type SubscriptionRegistry = TypedMultiMap[AbstractServiceKey, SubscriptionsKV] - type DDataKey = ORMultiMapKey[ServiceKey[_], Entry] + type DDataKey = ORMultiMapKey[ServiceKey[?], Entry] - final val EmptyORMultiMap = ORMultiMap.empty[ServiceKey[_], Entry] + final val EmptyORMultiMap = ORMultiMap.empty[ServiceKey[?], Entry] override val name = "clusterReceptionist" // values contain system uid to make it possible to discern actors at the same // path in different incarnations of a cluster node - final case class Entry(ref: ActorRef[_], systemUid: Long)(val createdTimestamp: Long) { + final case class Entry(ref: ActorRef[?], systemUid: Long)(val createdTimestamp: Long) { def uniqueAddress(selfAddress: Address): UniqueAddress = if (ref.path.address.hasLocalScope) UniqueAddress(selfAddress, systemUid) else UniqueAddress(ref.path.address, systemUid) @@ -79,7 +79,7 @@ private[typed] object ClusterReceptionist extends ReceptionistBehaviorProvider { private final case class NodeRemoved(addresses: UniqueAddress) extends InternalCommand private final case class NodeUnreachable(addresses: UniqueAddress) extends InternalCommand private final case class NodeReachable(addresses: UniqueAddress) extends InternalCommand - private final case class ChangeFromReplicator(key: DDataKey, value: ORMultiMap[ServiceKey[_], Entry]) + private final case class ChangeFromReplicator(key: DDataKey, value: ORMultiMap[ServiceKey[?], Entry]) extends InternalCommand private case object RemoveTick extends InternalCommand private case object PruneTombstonesTick extends InternalCommand @@ -93,12 +93,12 @@ private[typed] object ClusterReceptionist extends ReceptionistBehaviorProvider { */ final case class State( registry: ShardedServiceRegistry, - servicesPerActor: Map[ActorRef[_], Set[AbstractServiceKey]], - tombstones: Map[ActorRef[_], Set[(AbstractServiceKey, Deadline)]], + servicesPerActor: Map[ActorRef[?], Set[AbstractServiceKey]], + tombstones: Map[ActorRef[?], Set[(AbstractServiceKey, Deadline)]], subscriptions: SubscriptionRegistry) { /** tombstone all services actor is registered for */ - def addTombstone(actor: ActorRef[_], deadline: Deadline): State = { + def addTombstone(actor: ActorRef[?], deadline: Deadline): State = { servicesPerActor.getOrElse(actor, Set.empty).foldLeft(this) { (state, key) => state.addTombstone(actor.asInstanceOf[ActorRef[key.Protocol]], key.asServiceKey, deadline) } @@ -116,7 +116,7 @@ private[typed] object ClusterReceptionist extends ReceptionistBehaviorProvider { def pruneTombstones(): State = { if (tombstones.isEmpty) this else { - val newTombstones: Map[ActorRef[_], Set[(AbstractServiceKey, Deadline)]] = + val newTombstones: Map[ActorRef[?], Set[(AbstractServiceKey, Deadline)]] = tombstones.foldLeft(tombstones) { case (acc, (actorRef, entries)) => val entriesToKeep = entries.filter { @@ -218,10 +218,10 @@ private[typed] object ClusterReceptionist extends ReceptionistBehaviorProvider { // subscribe to changes from other nodes val replicatorMessageAdapter: ActorRef[Replicator.ReplicatorMessage] = ctx.messageAdapter[Replicator.ReplicatorMessage] { - case changed: Replicator.Changed[_] @unchecked => + case changed: Replicator.Changed[?] @unchecked => ChangeFromReplicator( changed.key.asInstanceOf[DDataKey], - changed.dataValue.asInstanceOf[ORMultiMap[ServiceKey[_], Entry]]) + changed.dataValue.asInstanceOf[ORMultiMap[ServiceKey[?], Entry]]) case _ => throw new IllegalArgumentException() // compiler exhaustiveness check pleaser } diff --git a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/receptionist/ClusterReceptionistSettings.scala b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/receptionist/ClusterReceptionistSettings.scala index 76a8231a7d0..73903be8aac 100644 --- a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/receptionist/ClusterReceptionistSettings.scala +++ b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/receptionist/ClusterReceptionistSettings.scala @@ -30,7 +30,7 @@ import pekko.util.Helpers.toRootLowerCase */ @InternalApi private[pekko] object ClusterReceptionistSettings { - def apply(system: ActorSystem[_]): ClusterReceptionistSettings = + def apply(system: ActorSystem[?]): ClusterReceptionistSettings = apply(system.settings.config.getConfig("pekko.cluster.typed.receptionist")) def apply(config: Config): ClusterReceptionistSettings = { diff --git a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/receptionist/Registry.scala b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/receptionist/Registry.scala index 3f96258eade..4693a550ff7 100644 --- a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/receptionist/Registry.scala +++ b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/receptionist/Registry.scala @@ -28,7 +28,7 @@ import pekko.cluster.typed.internal.receptionist.ClusterReceptionist.{ DDataKey, @InternalApi private[pekko] object ShardedServiceRegistry { def apply(numberOfKeys: Int): ShardedServiceRegistry = { val emptyRegistries = (0 until numberOfKeys).map { n => - val key = ORMultiMapKey[ServiceKey[_], Entry](s"ReceptionistKey_$n") + val key = ORMultiMapKey[ServiceKey[?], Entry](s"ReceptionistKey_$n") key -> new ServiceRegistry(EmptyORMultiMap) }.toMap new ShardedServiceRegistry(emptyRegistries, Set.empty, Set.empty) @@ -53,10 +53,10 @@ import pekko.cluster.typed.internal.receptionist.ClusterReceptionist.{ DDataKey, def allDdataKeys: Iterable[DDataKey] = keys - def ddataKeyFor(serviceKey: ServiceKey[_]): DDataKey = + def ddataKeyFor(serviceKey: ServiceKey[?]): DDataKey = keys(math.abs(serviceKey.id.hashCode() % serviceRegistries.size)) - def allServices: Iterator[(ServiceKey[_], Set[Entry])] = + def allServices: Iterator[(ServiceKey[?], Set[Entry])] = serviceRegistries.valuesIterator.flatMap(_.entries.entries) def allEntries: Iterator[Entry] = allServices.flatMap(_._2) @@ -113,7 +113,7 @@ import pekko.cluster.typed.internal.receptionist.ClusterReceptionist.{ DDataKey, /** * INTERNAL API */ -@InternalApi private[pekko] final case class ServiceRegistry(entries: ORMultiMap[ServiceKey[_], Entry]) extends AnyVal { +@InternalApi private[pekko] final case class ServiceRegistry(entries: ORMultiMap[ServiceKey[?], Entry]) extends AnyVal { // let's hide all the ugly casts we can in here def actorRefsFor[T](key: AbstractServiceKey): Set[ActorRef[key.Protocol]] = @@ -122,7 +122,7 @@ import pekko.cluster.typed.internal.receptionist.ClusterReceptionist.{ DDataKey, def entriesFor(key: AbstractServiceKey): Set[Entry] = entries.getOrElse(key.asServiceKey, Set.empty[Entry]) - def keysFor(address: UniqueAddress)(implicit node: SelfUniqueAddress): Set[ServiceKey[_]] = + def keysFor(address: UniqueAddress)(implicit node: SelfUniqueAddress): Set[ServiceKey[?]] = entries.entries.collect { case (key, entries) if entries.exists(_.uniqueAddress(node.uniqueAddress.address) == address) => key @@ -144,7 +144,7 @@ import pekko.cluster.typed.internal.receptionist.ClusterReceptionist.{ DDataKey, } } - def toORMultiMap: ORMultiMap[ServiceKey[_], Entry] = entries + def toORMultiMap: ORMultiMap[ServiceKey[?], Entry] = entries } diff --git a/cluster-typed/src/test/scala/docs/org/apache/pekko/cluster/typed/BasicClusterExampleSpec.scala b/cluster-typed/src/test/scala/docs/org/apache/pekko/cluster/typed/BasicClusterExampleSpec.scala index e994ba5f920..7625095790a 100644 --- a/cluster-typed/src/test/scala/docs/org/apache/pekko/cluster/typed/BasicClusterExampleSpec.scala +++ b/cluster-typed/src/test/scala/docs/org/apache/pekko/cluster/typed/BasicClusterExampleSpec.scala @@ -67,7 +67,7 @@ pekko { """).withFallback(configSystem1) def illustrateJoinSeedNodes(): Unit = { - val system: ActorSystem[_] = ??? + val system: ActorSystem[?] = ??? // #join-seed-nodes import pekko.actor.Address @@ -82,15 +82,15 @@ pekko { } object Backend { - def apply(): Behavior[_] = Behaviors.empty + def apply(): Behavior[?] = Behaviors.empty } object Frontend { - def apply(): Behavior[_] = Behaviors.empty + def apply(): Behavior[?] = Behaviors.empty } def illustrateRoles(): Unit = { - val context: ActorContext[_] = ??? + val context: ActorContext[?] = ??? // #hasRole val selfMember = Cluster(context.system).selfMember @@ -104,7 +104,7 @@ pekko { @nowarn("msg=never used") def illustrateDcAccess(): Unit = { - val system: ActorSystem[_] = ??? + val system: ActorSystem[?] = ??? // #dcAccess val cluster = Cluster(system) diff --git a/cluster-typed/src/test/scala/docs/org/apache/pekko/cluster/typed/DistributedPubSubExample.scala b/cluster-typed/src/test/scala/docs/org/apache/pekko/cluster/typed/DistributedPubSubExample.scala index ca85cb8b58f..2b63a1e22fb 100644 --- a/cluster-typed/src/test/scala/docs/org/apache/pekko/cluster/typed/DistributedPubSubExample.scala +++ b/cluster-typed/src/test/scala/docs/org/apache/pekko/cluster/typed/DistributedPubSubExample.scala @@ -306,13 +306,13 @@ object DistributedPubSubExample { pekko.loggers = ["org.apache.pekko.testkit.TestEventListener"] """) - def createCluster(nodes: List[ActorSystem[_]]): Unit = { - val clusterUp = (nodes: List[ActorSystem[_]], expected: Int) => + def createCluster(nodes: List[ActorSystem[?]]): Unit = { + val clusterUp = (nodes: List[ActorSystem[?]], expected: Int) => nodes.forall { s => Cluster(s).state.members.count(_.status == MemberStatus.up) == expected } - val awaitClusterUp = (nodes: List[ActorSystem[_]], expected: Int) => + val awaitClusterUp = (nodes: List[ActorSystem[?]], expected: Int) => while (!clusterUp(nodes, expected)) { Thread.sleep(1000) } diff --git a/cluster-typed/src/test/scala/org/apache/pekko/cluster/typed/GroupRouterSpec.scala b/cluster-typed/src/test/scala/org/apache/pekko/cluster/typed/GroupRouterSpec.scala index 449489f2c52..36baf91718d 100644 --- a/cluster-typed/src/test/scala/org/apache/pekko/cluster/typed/GroupRouterSpec.scala +++ b/cluster-typed/src/test/scala/org/apache/pekko/cluster/typed/GroupRouterSpec.scala @@ -47,7 +47,7 @@ object GroupRouterSpec { """) object PingActor { - case class Pong(workerActor: ActorRef[_]) extends CborSerializable + case class Pong(workerActor: ActorRef[?]) extends CborSerializable case class Ping(replyTo: ActorRef[Pong]) extends CborSerializable def apply(): Behavior[Ping] = Behaviors.receive { @@ -59,8 +59,8 @@ object GroupRouterSpec { object Pinger { sealed trait Command - private case class SawPong(worker: ActorRef[_]) extends Command - case class DonePinging(pongs: Int, uniqueWorkers: Set[ActorRef[_]]) + private case class SawPong(worker: ActorRef[?]) extends Command + case class DonePinging(pongs: Int, uniqueWorkers: Set[ActorRef[?]]) def apply( router: ActorRef[PingActor.Ping], requestedPings: Int, @@ -71,7 +71,7 @@ object GroupRouterSpec { } (0 to requestedPings).foreach(_ => router ! PingActor.Ping(pongAdapter)) var pongs = 0 - var uniqueWorkers = Set.empty[ActorRef[_]] + var uniqueWorkers = Set.empty[ActorRef[?]] Behaviors.receiveMessage { case SawPong(worker) => diff --git a/cluster/src/main/scala/org/apache/pekko/cluster/Cluster.scala b/cluster/src/main/scala/org/apache/pekko/cluster/Cluster.scala index b8b05df74dc..acda04f0c9a 100644 --- a/cluster/src/main/scala/org/apache/pekko/cluster/Cluster.scala +++ b/cluster/src/main/scala/org/apache/pekko/cluster/Cluster.scala @@ -266,7 +266,7 @@ class Cluster(val system: ExtendedActorSystem) extends Extension { * A snapshot of [[pekko.cluster.ClusterEvent.CurrentClusterState]] * will be sent to the subscriber as the first message. */ - @varargs def subscribe(subscriber: ActorRef, to: Class[_]*): Unit = + @varargs def subscribe(subscriber: ActorRef, to: Class[?]*): Unit = subscribe(subscriber, initialStateMode = InitialStateAsSnapshot, to: _*) /** @@ -284,7 +284,7 @@ class Cluster(val system: ExtendedActorSystem) extends Extension { * * Note that for large clusters it is more efficient to use `InitialStateAsSnapshot`. */ - @varargs def subscribe(subscriber: ActorRef, initialStateMode: SubscriptionInitialStateMode, to: Class[_]*): Unit = { + @varargs def subscribe(subscriber: ActorRef, initialStateMode: SubscriptionInitialStateMode, to: Class[?]*): Unit = { require(to.length > 0, "at least one `ClusterDomainEvent` class is required") require( to.forall(classOf[ClusterDomainEvent].isAssignableFrom), @@ -303,7 +303,7 @@ class Cluster(val system: ExtendedActorSystem) extends Extension { * Unsubscribe to a specific type of cluster domain events, * matching previous `subscribe` registration. */ - def unsubscribe(subscriber: ActorRef, to: Class[_]): Unit = + def unsubscribe(subscriber: ActorRef, to: Class[?]): Unit = clusterCore ! InternalClusterAction.Unsubscribe(subscriber, Some(to)) /** diff --git a/cluster/src/main/scala/org/apache/pekko/cluster/ClusterDaemon.scala b/cluster/src/main/scala/org/apache/pekko/cluster/ClusterDaemon.scala index e7f4fca5ddd..dc428ca8ffe 100644 --- a/cluster/src/main/scala/org/apache/pekko/cluster/ClusterDaemon.scala +++ b/cluster/src/main/scala/org/apache/pekko/cluster/ClusterDaemon.scala @@ -179,9 +179,9 @@ private[cluster] object InternalClusterAction { final case class AddOnMemberRemovedListener(callback: Runnable) extends NoSerializationVerificationNeeded sealed trait SubscriptionMessage - final case class Subscribe(subscriber: ActorRef, initialStateMode: SubscriptionInitialStateMode, to: Set[Class[_]]) + final case class Subscribe(subscriber: ActorRef, initialStateMode: SubscriptionInitialStateMode, to: Set[Class[?]]) extends SubscriptionMessage - final case class Unsubscribe(subscriber: ActorRef, to: Option[Class[_]]) + final case class Unsubscribe(subscriber: ActorRef, to: Option[Class[?]]) extends SubscriptionMessage with DeadLetterSuppression diff --git a/cluster/src/main/scala/org/apache/pekko/cluster/ClusterEvent.scala b/cluster/src/main/scala/org/apache/pekko/cluster/ClusterEvent.scala index 9a0f2f9af8f..b9209a8856b 100644 --- a/cluster/src/main/scala/org/apache/pekko/cluster/ClusterEvent.scala +++ b/cluster/src/main/scala/org/apache/pekko/cluster/ClusterEvent.scala @@ -731,7 +731,7 @@ private[cluster] final class ClusterDomainEventPublisher receiver ! state } - def subscribe(subscriber: ActorRef, initMode: SubscriptionInitialStateMode, to: Set[Class[_]]): Unit = { + def subscribe(subscriber: ActorRef, initMode: SubscriptionInitialStateMode, to: Set[Class[?]]): Unit = { initMode match { case InitialStateAsEvents => def pub(event: AnyRef): Unit = { @@ -746,7 +746,7 @@ private[cluster] final class ClusterDomainEventPublisher to.foreach { eventStream.subscribe(subscriber, _) } } - def unsubscribe(subscriber: ActorRef, to: Option[Class[_]]): Unit = to match { + def unsubscribe(subscriber: ActorRef, to: Option[Class[?]]): Unit = to match { case None => eventStream.unsubscribe(subscriber) case Some(c) => eventStream.unsubscribe(subscriber, c) } diff --git a/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/SurviveNetworkInstabilitySpec.scala b/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/SurviveNetworkInstabilitySpec.scala index 724c35c2a16..acca542187f 100644 --- a/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/SurviveNetworkInstabilitySpec.scala +++ b/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/SurviveNetworkInstabilitySpec.scala @@ -103,7 +103,7 @@ abstract class SurviveNetworkInstabilitySpec private val remoteSettings = RARP(system).provider.remoteSettings @nowarn - def quarantinedEventClass: Class[_] = + def quarantinedEventClass: Class[?] = if (remoteSettings.Artery.Enabled) classOf[QuarantinedEvent] else diff --git a/coordination/src/main/scala/org/apache/pekko/coordination/lease/scaladsl/LeaseProvider.scala b/coordination/src/main/scala/org/apache/pekko/coordination/lease/scaladsl/LeaseProvider.scala index 3e2ef3eb139..cdf093f3498 100644 --- a/coordination/src/main/scala/org/apache/pekko/coordination/lease/scaladsl/LeaseProvider.scala +++ b/coordination/src/main/scala/org/apache/pekko/coordination/lease/scaladsl/LeaseProvider.scala @@ -116,7 +116,7 @@ final class LeaseProvider(system: ExtendedActorSystem) extends Extension { s case Failure(_: NoSuchMethodException) => dynamicAccess.createInstanceFor[T](fqcn, immutable.Seq((classOf[LeaseSettings], leaseSettings))) - case f: Failure[_] => + case f: Failure[?] => f } diff --git a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/Key.scala b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/Key.scala index 1a3dca332d1..8618f255809 100644 --- a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/Key.scala +++ b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/Key.scala @@ -18,7 +18,7 @@ object Key { /** * Extract the [[Key#id]]. */ - def unapply(k: Key[_]): Option[String] = Some(k.id) + def unapply(k: Key[?]): Option[String] = Some(k.id) private[pekko] type KeyR = Key[ReplicatedData] @@ -37,7 +37,7 @@ object Key { abstract class Key[+T <: ReplicatedData](val id: Key.KeyId) extends Serializable { override final def equals(o: Any): Boolean = o match { - case k: Key[_] => id == k.id + case k: Key[?] => id == k.id case _ => false } diff --git a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/LWWMap.scala b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/LWWMap.scala index 13fe25345c2..abcad716acc 100644 --- a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/LWWMap.scala +++ b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/LWWMap.scala @@ -213,7 +213,7 @@ final class LWWMap[A, B] private[pekko] (private[pekko] val underlying: ORMap[A, override def toString: String = s"LWW$entries" // e.g. LWWMap(a -> 1, b -> 2) override def equals(o: Any): Boolean = o match { - case other: LWWMap[_, _] => underlying == other.underlying + case other: LWWMap[?, ?] => underlying == other.underlying case _ => false } diff --git a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/LWWRegister.scala b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/LWWRegister.scala index d53f561f681..381f446889d 100644 --- a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/LWWRegister.scala +++ b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/LWWRegister.scala @@ -213,7 +213,7 @@ final class LWWRegister[A] private[pekko] (private[pekko] val node: UniqueAddres override def toString: String = s"LWWRegister($value)" override def equals(o: Any): Boolean = o match { - case other: LWWRegister[_] => + case other: LWWRegister[?] => timestamp == other.timestamp && value == other.value && node == other.node case _ => false } diff --git a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/ORMap.scala b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/ORMap.scala index 70b66681bd1..ef392627869 100644 --- a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/ORMap.scala +++ b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/ORMap.scala @@ -70,7 +70,7 @@ object ORMap { def zeroTag: ZeroTag override def zero: DeltaReplicatedData = zeroTag.zero override def merge(that: DeltaOp): DeltaOp = that match { - case other: AtomicDeltaOp[_, _] => DeltaGroup(Vector(this, other)) + case other: AtomicDeltaOp[?, ?] => DeltaGroup(Vector(this, other)) case DeltaGroup(ops) => DeltaGroup(this +: ops) } override def deltaSize: Int = 1 @@ -84,9 +84,9 @@ object ORMap { zeroTag: ZeroTag) extends AtomicDeltaOp[A, B] { override def merge(that: DeltaOp): DeltaOp = that match { - case put: PutDeltaOp[_, _] if this.value._1 == put.value._1 => + case put: PutDeltaOp[?, ?] if this.value._1 == put.value._1 => new PutDeltaOp[A, B](this.underlying.merge(put.underlying), put.asInstanceOf[PutDeltaOp[A, B]].value, zeroTag) - case update: UpdateDeltaOp[_, _] + case update: UpdateDeltaOp[?, ?] if update.values.size == 1 && update.asInstanceOf[UpdateDeltaOp[A, B]].values.contains(this.value._1) => val (key, elem1) = this.value val newValue = elem1 match { @@ -98,7 +98,7 @@ object ORMap { (key, elem1.merge(elem2).asInstanceOf[B]) } new PutDeltaOp[A, B](this.underlying.merge(update.underlying), newValue, zeroTag) - case other: AtomicDeltaOp[_, _] => DeltaGroup(Vector(this, other)) + case other: AtomicDeltaOp[?, ?] => DeltaGroup(Vector(this, other)) case DeltaGroup(ops) => DeltaGroup(this +: ops) } } @@ -111,7 +111,7 @@ object ORMap { zeroTag: ZeroTag) extends AtomicDeltaOp[A, B] { override def merge(that: DeltaOp): DeltaOp = that match { - case update: UpdateDeltaOp[_, _] => + case update: UpdateDeltaOp[?, ?] => new UpdateDeltaOp[A, B]( this.underlying.merge(update.underlying), update.asInstanceOf[UpdateDeltaOp[A, B]].values.foldLeft(this.values) { (map, pair) => @@ -123,10 +123,10 @@ object ORMap { } else map + pair }, zeroTag) - case put: PutDeltaOp[_, _] + case put: PutDeltaOp[?, ?] if this.values.size == 1 && this.values.contains(put.asInstanceOf[PutDeltaOp[A, B]].value._1) => new PutDeltaOp[A, B](this.underlying.merge(put.underlying), put.asInstanceOf[PutDeltaOp[A, B]].value, zeroTag) - case other: AtomicDeltaOp[_, _] => DeltaGroup(Vector(this, other)) + case other: AtomicDeltaOp[?, ?] => DeltaGroup(Vector(this, other)) case DeltaGroup(ops) => DeltaGroup(this +: ops) } } @@ -152,18 +152,18 @@ object ORMap { extends DeltaOp with ReplicatedDeltaSize { override def merge(that: DeltaOp): DeltaOp = that match { - case that: AtomicDeltaOp[_, _] => + case that: AtomicDeltaOp[?, ?] => ops.last match { - case thisPut: PutDeltaOp[_, _] => + case thisPut: PutDeltaOp[?, ?] => val merged = thisPut.merge(that) merged match { - case op: AtomicDeltaOp[_, _] => DeltaGroup(ops.dropRight(1) :+ op) + case op: AtomicDeltaOp[?, ?] => DeltaGroup(ops.dropRight(1) :+ op) case DeltaGroup(thatOps) => DeltaGroup(ops.dropRight(1) ++ thatOps) } - case thisUpdate: UpdateDeltaOp[_, _] => + case thisUpdate: UpdateDeltaOp[?, ?] => val merged = thisUpdate.merge(that) merged match { - case op: AtomicDeltaOp[_, _] => DeltaGroup(ops.dropRight(1) :+ op) + case op: AtomicDeltaOp[?, ?] => DeltaGroup(ops.dropRight(1) :+ op) case DeltaGroup(thatOps) => DeltaGroup(ops.dropRight(1) ++ thatOps) } case _ => DeltaGroup(ops :+ that) @@ -266,7 +266,7 @@ final class ORMap[A, B <: ReplicatedData] private[pekko] ( * INTERNAL API */ @InternalApi private[pekko] def put(node: UniqueAddress, key: A, value: B): ORMap[A, B] = - if (value.isInstanceOf[ORSet[_]] && values.contains(key)) + if (value.isInstanceOf[ORSet[?]] && values.contains(key)) throw new IllegalArgumentException( "`ORMap.put` must not be used to replace an existing `ORSet` " + "value, because important history can be lost when replacing the `ORSet` and " + @@ -449,23 +449,23 @@ final class ORMap[A, B <: ReplicatedData] private[pekko] ( } val processDelta: PartialFunction[ORMap.DeltaOp, Unit] = { - case putOp: PutDeltaOp[_, _] => + case putOp: PutDeltaOp[?, ?] => val keyDelta = putOp.underlying mergedKeys = mergedKeys.mergeDelta(keyDelta) mergedValues = mergedValues + putOp .asInstanceOf[PutDeltaOp[A, B]] .value // put is destructive and propagates only full values of B! - case removeOp: RemoveDeltaOp[_, _] => + case removeOp: RemoveDeltaOp[?, ?] => val removedKey = removeOp.underlying match { // if op is RemoveDeltaOp then it must have exactly one element in the elements - case op: ORSet.RemoveDeltaOp[_] => op.underlying.elements.head.asInstanceOf[A] + case op: ORSet.RemoveDeltaOp[?] => op.underlying.elements.head.asInstanceOf[A] case _ => throw new IllegalArgumentException("ORMap.RemoveDeltaOp must contain ORSet.RemoveDeltaOp inside") } mergedValues = mergedValues - removedKey mergedKeys = mergedKeys.mergeDelta(removeOp.underlying) // please note that if RemoveDeltaOp is not preceded by update clearing the value // anomalies may result - case removeKeyOp: RemoveKeyDeltaOp[_, _] => + case removeKeyOp: RemoveKeyDeltaOp[?, ?] => // removeKeyOp tombstones values for later use if (mergedValues.contains(removeKeyOp.asInstanceOf[RemoveKeyDeltaOp[A, B]].removedKey)) { tombstonedVals = tombstonedVals + (removeKeyOp @@ -474,7 +474,7 @@ final class ORMap[A, B <: ReplicatedData] private[pekko] ( } mergedValues = mergedValues - removeKeyOp.asInstanceOf[RemoveKeyDeltaOp[A, B]].removedKey mergedKeys = mergedKeys.mergeDelta(removeKeyOp.underlying) - case updateOp: UpdateDeltaOp[_, _] => + case updateOp: UpdateDeltaOp[?, ?] => mergedKeys = mergedKeys.mergeDelta(updateOp.underlying) updateOp.asInstanceOf[UpdateDeltaOp[A, B]].values.foreach { case (key, value) => @@ -574,7 +574,7 @@ final class ORMap[A, B <: ReplicatedData] private[pekko] ( override def toString: String = s"OR$entries" override def equals(o: Any): Boolean = o match { - case other: ORMap[_, _] => keys == other.keys && values == other.values + case other: ORMap[?, ?] => keys == other.keys && values == other.values case _ => false } diff --git a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/ORMultiMap.scala b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/ORMultiMap.scala index 36c3eb4ef51..1bc6cd8b33a 100644 --- a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/ORMultiMap.scala +++ b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/ORMultiMap.scala @@ -362,7 +362,7 @@ final class ORMultiMap[A, B] private[pekko] ( override def toString: String = s"ORMulti$entries" override def equals(o: Any): Boolean = o match { - case other: ORMultiMap[_, _] => underlying == other.underlying + case other: ORMultiMap[?, ?] => underlying == other.underlying case _ => false } 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 1fc533144ab..e29a0467267 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 @@ -89,7 +89,7 @@ object ORSet { // Note that we only merge deltas originating from the same node AddDeltaOp( new ORSet(concatElementsMap(u.elementsMap.asInstanceOf[Map[A, Dot]]), underlying.vvector.merge(u.vvector))) - case _: AtomicDeltaOp[_] => DeltaGroup(Vector(this, that)) + case _: AtomicDeltaOp[?] => DeltaGroup(Vector(this, that)) case DeltaGroup(ops) => DeltaGroup(this +: ops) } @@ -108,7 +108,7 @@ object ORSet { throw new IllegalArgumentException(s"RemoveDeltaOp should contain one removed element, but was $underlying") override def merge(that: DeltaOp): DeltaOp = that match { - case _: AtomicDeltaOp[_] => DeltaGroup(Vector(this, that)) // keep it simple for removals + case _: AtomicDeltaOp[?] => DeltaGroup(Vector(this, that)) // keep it simple for removals case DeltaGroup(ops) => DeltaGroup(this +: ops) } } @@ -116,7 +116,7 @@ object ORSet { /** INTERNAL API: Used for `clear` but could be used for other cases also */ @InternalApi private[pekko] final case class FullStateDeltaOp[A](underlying: ORSet[A]) extends AtomicDeltaOp[A] { override def merge(that: DeltaOp): DeltaOp = that match { - case _: AtomicDeltaOp[_] => DeltaGroup(Vector(this, that)) + case _: AtomicDeltaOp[?] => DeltaGroup(Vector(this, that)) case DeltaGroup(ops) => DeltaGroup(this +: ops) } } @@ -128,10 +128,10 @@ object ORSet { extends DeltaOp with ReplicatedDeltaSize { override def merge(that: DeltaOp): DeltaOp = that match { - case thatAdd: AddDeltaOp[_] => + case thatAdd: AddDeltaOp[?] => // merge AddDeltaOp into last AddDeltaOp in the group, if possible ops.last match { - case thisAdd: AddDeltaOp[_] => DeltaGroup(ops.dropRight(1) :+ thisAdd.merge(thatAdd)) + case thisAdd: AddDeltaOp[?] => DeltaGroup(ops.dropRight(1) :+ thisAdd.merge(thatAdd)) case _ => DeltaGroup(ops :+ thatAdd) } case DeltaGroup(thatOps) => DeltaGroup(ops ++ thatOps) @@ -369,7 +369,7 @@ final class ORSet[A] private[pekko] ( val newDelta = delta match { case None => ORSet.AddDeltaOp(new ORSet(Map(element -> newDot), newDot)) - case Some(existing: ORSet.AddDeltaOp[_]) => + case Some(existing: ORSet.AddDeltaOp[?]) => existing.merge(ORSet.AddDeltaOp(new ORSet(Map(element -> newDot), newDot))) case Some(d) => d.merge(ORSet.AddDeltaOp(new ORSet(Map(element -> newDot), newDot))) @@ -482,18 +482,18 @@ final class ORSet[A] private[pekko] ( override def mergeDelta(thatDelta: ORSet.DeltaOp): ORSet[A] = { thatDelta match { - case d: ORSet.AddDeltaOp[_] => dryMerge(d.asInstanceOf[ORSet.AddDeltaOp[A]].underlying, addDeltaOp = true) - case d: ORSet.RemoveDeltaOp[_] => mergeRemoveDelta(d.asInstanceOf[ORSet.RemoveDeltaOp[A]]) - case d: ORSet.FullStateDeltaOp[_] => + case d: ORSet.AddDeltaOp[?] => dryMerge(d.asInstanceOf[ORSet.AddDeltaOp[A]].underlying, addDeltaOp = true) + case d: ORSet.RemoveDeltaOp[?] => mergeRemoveDelta(d.asInstanceOf[ORSet.RemoveDeltaOp[A]]) + case d: ORSet.FullStateDeltaOp[?] => dryMerge(d.asInstanceOf[ORSet.FullStateDeltaOp[A]].underlying, addDeltaOp = false) case ORSet.DeltaGroup(ops) => ops.foldLeft(this) { - case (acc, op: ORSet.AddDeltaOp[_]) => + case (acc, op: ORSet.AddDeltaOp[?]) => acc.dryMerge(op.asInstanceOf[ORSet.AddDeltaOp[A]].underlying, addDeltaOp = true) - case (acc, op: ORSet.RemoveDeltaOp[_]) => acc.mergeRemoveDelta(op.asInstanceOf[ORSet.RemoveDeltaOp[A]]) - case (acc, op: ORSet.FullStateDeltaOp[_]) => + case (acc, op: ORSet.RemoveDeltaOp[?]) => acc.mergeRemoveDelta(op.asInstanceOf[ORSet.RemoveDeltaOp[A]]) + case (acc, op: ORSet.FullStateDeltaOp[?]) => acc.dryMerge(op.asInstanceOf[ORSet.FullStateDeltaOp[A]].underlying, addDeltaOp = false) - case (_, _: ORSet.DeltaGroup[_]) => + case (_, _: ORSet.DeltaGroup[?]) => throw new IllegalArgumentException("ORSet.DeltaGroup should not be nested") } } @@ -578,7 +578,7 @@ final class ORSet[A] private[pekko] ( override def toString: String = s"OR$elements" override def equals(o: Any): Boolean = o match { - case other: ORSet[_] => vvector == other.vvector && elementsMap == other.elementsMap + case other: ORSet[?] => vvector == other.vvector && elementsMap == other.elementsMap case _ => false } diff --git a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/PNCounterMap.scala b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/PNCounterMap.scala index b4357f47bdb..fa64d53ca0a 100644 --- a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/PNCounterMap.scala +++ b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/PNCounterMap.scala @@ -199,7 +199,7 @@ final class PNCounterMap[A] private[pekko] (private[pekko] val underlying: ORMap override def toString: String = s"PNCounter$entries" override def equals(o: Any): Boolean = o match { - case other: PNCounterMap[_] => underlying == other.underlying + case other: PNCounterMap[?] => underlying == other.underlying case _ => false } diff --git a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/Replicator.scala b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/Replicator.scala index 8b64e33ec66..13a19be4731 100644 --- a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/Replicator.scala +++ b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/Replicator.scala @@ -2675,10 +2675,10 @@ final class Replicator(settings: ReplicatorSettings) extends Actor with ActorLog // Try again with the full state sender() ! writeMsg - case _: Replicator.UpdateSuccess[_] => + case _: Replicator.UpdateSuccess[?] => gotLocalStoreReply = true if (isDone) reply(isTimeout = false) - case _: Replicator.StoreFailure[_] => + case _: Replicator.StoreFailure[?] => gotLocalStoreReply = true gotWriteNackFrom += selfUniqueAddress.address if (isDone) reply(isTimeout = false) diff --git a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/protobuf/ReplicatedDataSerializer.scala b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/protobuf/ReplicatedDataSerializer.scala index 759e17b4c03..416cfe10120 100644 --- a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/protobuf/ReplicatedDataSerializer.scala +++ b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/protobuf/ReplicatedDataSerializer.scala @@ -339,67 +339,67 @@ class ReplicatedDataSerializer(val system: ExtendedActorSystem) ORMultiMapKeyManifest -> (bytes => ORMultiMapKey(keyIdFromBinary(bytes)))) override def manifest(obj: AnyRef): String = obj match { - case _: ORSet[_] => ORSetManifest - case _: ORSet.AddDeltaOp[_] => ORSetAddManifest - case _: ORSet.RemoveDeltaOp[_] => ORSetRemoveManifest - case _: GSet[_] => GSetManifest + case _: ORSet[?] => ORSetManifest + case _: ORSet.AddDeltaOp[?] => ORSetAddManifest + case _: ORSet.RemoveDeltaOp[?] => ORSetRemoveManifest + case _: GSet[?] => GSetManifest case _: GCounter => GCounterManifest case _: PNCounter => PNCounterManifest case _: Flag => FlagManifest - case _: LWWRegister[_] => LWWRegisterManifest - case _: ORMap[_, _] => ORMapManifest - case _: ORMap.PutDeltaOp[_, _] => ORMapPutManifest - case _: ORMap.RemoveDeltaOp[_, _] => ORMapRemoveManifest - case _: ORMap.RemoveKeyDeltaOp[_, _] => ORMapRemoveKeyManifest - case _: ORMap.UpdateDeltaOp[_, _] => ORMapUpdateManifest - case _: LWWMap[_, _] => LWWMapManifest - case _: PNCounterMap[_] => PNCounterMapManifest - case _: ORMultiMap[_, _] => ORMultiMapManifest + case _: LWWRegister[?] => LWWRegisterManifest + case _: ORMap[?, ?] => ORMapManifest + case _: ORMap.PutDeltaOp[?, ?] => ORMapPutManifest + case _: ORMap.RemoveDeltaOp[?, ?] => ORMapRemoveManifest + case _: ORMap.RemoveKeyDeltaOp[?, ?] => ORMapRemoveKeyManifest + case _: ORMap.UpdateDeltaOp[?, ?] => ORMapUpdateManifest + case _: LWWMap[?, ?] => LWWMapManifest + case _: PNCounterMap[?] => PNCounterMapManifest + case _: ORMultiMap[?, ?] => ORMultiMapManifest case DeletedData => DeletedDataManifest case _: VersionVector => VersionVectorManifest - case _: ORSetKey[_] => ORSetKeyManifest - case _: GSetKey[_] => GSetKeyManifest + case _: ORSetKey[?] => ORSetKeyManifest + case _: GSetKey[?] => GSetKeyManifest case _: GCounterKey => GCounterKeyManifest case _: PNCounterKey => PNCounterKeyManifest case _: FlagKey => FlagKeyManifest - case _: LWWRegisterKey[_] => LWWRegisterKeyManifest - case _: ORMapKey[_, _] => ORMapKeyManifest - case _: LWWMapKey[_, _] => LWWMapKeyManifest - case _: PNCounterMapKey[_] => PNCounterMapKeyManifest - case _: ORMultiMapKey[_, _] => ORMultiMapKeyManifest + case _: LWWRegisterKey[?] => LWWRegisterKeyManifest + case _: ORMapKey[?, ?] => ORMapKeyManifest + case _: LWWMapKey[?, ?] => LWWMapKeyManifest + case _: PNCounterMapKey[?] => PNCounterMapKeyManifest + case _: ORMultiMapKey[?, ?] => ORMultiMapKeyManifest - case _: ORSet.DeltaGroup[_] => ORSetDeltaGroupManifest - case _: ORMap.DeltaGroup[_, _] => ORMapDeltaGroupManifest - case _: ORSet.FullStateDeltaOp[_] => ORSetFullManifest + case _: ORSet.DeltaGroup[?] => ORSetDeltaGroupManifest + case _: ORMap.DeltaGroup[?, ?] => ORMapDeltaGroupManifest + case _: ORSet.FullStateDeltaOp[?] => ORSetFullManifest case _ => throw new IllegalArgumentException(s"Can't serialize object of type ${obj.getClass} in [${getClass.getName}]") } def toBinary(obj: AnyRef): Array[Byte] = obj match { - case m: ORSet[_] => compress(orsetToProto(m)) - case m: ORSet.AddDeltaOp[_] => orsetToProto(m.underlying).toByteArray - case m: ORSet.RemoveDeltaOp[_] => orsetToProto(m.underlying).toByteArray - case m: GSet[_] => gsetToProto(m).toByteArray + case m: ORSet[?] => compress(orsetToProto(m)) + case m: ORSet.AddDeltaOp[?] => orsetToProto(m.underlying).toByteArray + case m: ORSet.RemoveDeltaOp[?] => orsetToProto(m.underlying).toByteArray + case m: GSet[?] => gsetToProto(m).toByteArray case m: GCounter => gcounterToProto(m).toByteArray case m: PNCounter => pncounterToProto(m).toByteArray case m: Flag => flagToProto(m).toByteArray - case m: LWWRegister[_] => lwwRegisterToProto(m).toByteArray - case m: ORMap[_, _] => compress(ormapToProto(m)) - case m: ORMap.PutDeltaOp[_, _] => ormapPutToProto(m).toByteArray - case m: ORMap.RemoveDeltaOp[_, _] => ormapRemoveToProto(m).toByteArray - case m: ORMap.RemoveKeyDeltaOp[_, _] => ormapRemoveKeyToProto(m).toByteArray - case m: ORMap.UpdateDeltaOp[_, _] => ormapUpdateToProto(m).toByteArray - case m: LWWMap[_, _] => compress(lwwmapToProto(m)) - case m: PNCounterMap[_] => compress(pncountermapToProto(m)) - case m: ORMultiMap[_, _] => compress(multimapToProto(m)) + case m: LWWRegister[?] => lwwRegisterToProto(m).toByteArray + case m: ORMap[?, ?] => compress(ormapToProto(m)) + case m: ORMap.PutDeltaOp[?, ?] => ormapPutToProto(m).toByteArray + case m: ORMap.RemoveDeltaOp[?, ?] => ormapRemoveToProto(m).toByteArray + case m: ORMap.RemoveKeyDeltaOp[?, ?] => ormapRemoveKeyToProto(m).toByteArray + case m: ORMap.UpdateDeltaOp[?, ?] => ormapUpdateToProto(m).toByteArray + case m: LWWMap[?, ?] => compress(lwwmapToProto(m)) + case m: PNCounterMap[?] => compress(pncountermapToProto(m)) + case m: ORMultiMap[?, ?] => compress(multimapToProto(m)) case DeletedData => dm.Empty.getDefaultInstance.toByteArray case m: VersionVector => versionVectorToProto(m).toByteArray case Key(id) => keyIdToBinary(id) - case m: ORSet.DeltaGroup[_] => orsetDeltaGroupToProto(m).toByteArray - case m: ORMap.DeltaGroup[_, _] => ormapDeltaGroupToProto(m).toByteArray - case m: ORSet.FullStateDeltaOp[_] => orsetToProto(m.underlying).toByteArray + case m: ORSet.DeltaGroup[?] => orsetDeltaGroupToProto(m).toByteArray + case m: ORMap.DeltaGroup[?, ?] => ormapDeltaGroupToProto(m).toByteArray + case m: ORSet.FullStateDeltaOp[?] => orsetToProto(m.underlying).toByteArray case _ => throw new IllegalArgumentException(s"Can't serialize object of type ${obj.getClass} in [${getClass.getName}]") } @@ -412,7 +412,7 @@ class ReplicatedDataSerializer(val system: ExtendedActorSystem) s"Unimplemented deserialization of message with manifest [$manifest] in [${getClass.getName}]") } - def gsetToProto(gset: GSet[_]): rd.GSet = { + def gsetToProto(gset: GSet[?]): rd.GSet = { val b = rd.GSet.newBuilder() // using java collections and sorting for performance (avoid conversions) val stringElements = new ArrayList[String] @@ -450,7 +450,7 @@ class ReplicatedDataSerializer(val system: ExtendedActorSystem) b.build() } - def gsetFromBinary(bytes: Array[Byte]): GSet[_] = + def gsetFromBinary(bytes: Array[Byte]): GSet[?] = gsetFromProto(rd.GSet.parseFrom(bytes)) def gsetFromProto(gset: rd.GSet): GSet[Any] = { @@ -464,7 +464,7 @@ class ReplicatedDataSerializer(val system: ExtendedActorSystem) GSet(elements.toSet) } - def orsetToProto(orset: ORSet[_]): rd.ORSet = + def orsetToProto(orset: ORSet[?]): rd.ORSet = orsetToProtoImpl(orset.asInstanceOf[ORSet[Any]]) private def orsetToProtoImpl(orset: ORSet[Any]): rd.ORSet = { @@ -488,7 +488,7 @@ class ReplicatedDataSerializer(val system: ExtendedActorSystem) otherElementsMap = otherElementsMap.updated(enclosedMsg, other) } - def addDots(elements: ArrayList[_]): Unit = { + def addDots(elements: ArrayList[?]): Unit = { // add corresponding dots in same order val iter = elements.iterator while (iter.hasNext) { @@ -544,8 +544,8 @@ class ReplicatedDataSerializer(val system: ExtendedActorSystem) private def orsetFullFromBinary(bytes: Array[Byte]): ORSet.FullStateDeltaOp[Any] = new ORSet.FullStateDeltaOp(orsetFromProto(rd.ORSet.parseFrom(bytes))) - private def orsetDeltaGroupToProto(deltaGroup: ORSet.DeltaGroup[_]): rd.ORSetDeltaGroup = { - def createEntry(opType: rd.ORSetDeltaOp, u: ORSet[_]) = { + private def orsetDeltaGroupToProto(deltaGroup: ORSet.DeltaGroup[?]): rd.ORSetDeltaGroup = { + def createEntry(opType: rd.ORSetDeltaOp, u: ORSet[?]) = { rd.ORSetDeltaGroup.Entry.newBuilder().setOperation(opType).setUnderlying(orsetToProto(u)) } @@ -605,7 +605,7 @@ class ReplicatedDataSerializer(val system: ExtendedActorSystem) def flagFromProto(flag: rd.Flag): Flag = if (flag.getEnabled) Flag.Enabled else Flag.Disabled - def lwwRegisterToProto(lwwRegister: LWWRegister[_]): rd.LWWRegister = + def lwwRegisterToProto(lwwRegister: LWWRegister[?]): rd.LWWRegister = rd.LWWRegister .newBuilder() .setTimestamp(lwwRegister.timestamp) @@ -684,7 +684,7 @@ class ReplicatedDataSerializer(val system: ExtendedActorSystem) protoEntries } - def ormapToProto(ormap: ORMap[_, _]): rd.ORMap = { + def ormapToProto(ormap: ORMap[?, ?]): rd.ORMap = { val ormapBuilder = rd.ORMap.newBuilder() val entries: jl.Iterable[rd.ORMap.Entry] = getEntries(ormap.values, rd.ORMap.Entry.newBuilder _, otherMessageToProto) @@ -741,7 +741,7 @@ class ReplicatedDataSerializer(val system: ExtendedActorSystem) // wire protocol is always DeltaGroup private def ormapPutFromBinary(bytes: Array[Byte]): ORMap.PutDeltaOp[Any, ReplicatedData] = { val ops = ormapDeltaGroupOpsFromBinary(bytes) - if (ops.size == 1 && ops.head.isInstanceOf[ORMap.PutDeltaOp[_, _]]) + if (ops.size == 1 && ops.head.isInstanceOf[ORMap.PutDeltaOp[?, ?]]) ops.head.asInstanceOf[ORMap.PutDeltaOp[Any, ReplicatedData]] else throw new NotSerializableException("Improper ORMap delta put operation size or kind") @@ -750,7 +750,7 @@ class ReplicatedDataSerializer(val system: ExtendedActorSystem) // wire protocol is always delta group private def ormapRemoveFromBinary(bytes: Array[Byte]): ORMap.RemoveDeltaOp[Any, ReplicatedData] = { val ops = ormapDeltaGroupOpsFromBinary(bytes) - if (ops.size == 1 && ops.head.isInstanceOf[ORMap.RemoveDeltaOp[_, _]]) + if (ops.size == 1 && ops.head.isInstanceOf[ORMap.RemoveDeltaOp[?, ?]]) ops.head.asInstanceOf[ORMap.RemoveDeltaOp[Any, ReplicatedData]] else throw new NotSerializableException("Improper ORMap delta remove operation size or kind") @@ -759,7 +759,7 @@ class ReplicatedDataSerializer(val system: ExtendedActorSystem) // wire protocol is always delta group private def ormapRemoveKeyFromBinary(bytes: Array[Byte]): ORMap.RemoveKeyDeltaOp[Any, ReplicatedData] = { val ops = ormapDeltaGroupOpsFromBinary(bytes) - if (ops.size == 1 && ops.head.isInstanceOf[ORMap.RemoveKeyDeltaOp[_, _]]) + if (ops.size == 1 && ops.head.isInstanceOf[ORMap.RemoveKeyDeltaOp[?, ?]]) ops.head.asInstanceOf[ORMap.RemoveKeyDeltaOp[Any, ReplicatedData]] else throw new NotSerializableException("Improper ORMap delta remove key operation size or kind") @@ -768,7 +768,7 @@ class ReplicatedDataSerializer(val system: ExtendedActorSystem) // wire protocol is always delta group private def ormapUpdateFromBinary(bytes: Array[Byte]): ORMap.UpdateDeltaOp[Any, ReplicatedDelta] = { val ops = ormapDeltaGroupOpsFromBinary(bytes) - if (ops.size == 1 && ops.head.isInstanceOf[ORMap.UpdateDeltaOp[_, _]]) + if (ops.size == 1 && ops.head.isInstanceOf[ORMap.UpdateDeltaOp[?, ?]]) ops.head.asInstanceOf[ORMap.UpdateDeltaOp[Any, ReplicatedDelta]] else throw new NotSerializableException("Improper ORMap delta update operation size or kind") @@ -827,28 +827,28 @@ class ReplicatedDataSerializer(val system: ExtendedActorSystem) ops } - private def ormapPutToProto(deltaOp: ORMap.PutDeltaOp[_, _]): rd.ORMapDeltaGroup = { + private def ormapPutToProto(deltaOp: ORMap.PutDeltaOp[?, ?]): rd.ORMapDeltaGroup = { ormapDeltaGroupOpsToProto(immutable.IndexedSeq(deltaOp.asInstanceOf[ORMap.DeltaOp])) } - private def ormapRemoveToProto(deltaOp: ORMap.RemoveDeltaOp[_, _]): rd.ORMapDeltaGroup = { + private def ormapRemoveToProto(deltaOp: ORMap.RemoveDeltaOp[?, ?]): rd.ORMapDeltaGroup = { ormapDeltaGroupOpsToProto(immutable.IndexedSeq(deltaOp.asInstanceOf[ORMap.DeltaOp])) } - private def ormapRemoveKeyToProto(deltaOp: ORMap.RemoveKeyDeltaOp[_, _]): rd.ORMapDeltaGroup = { + private def ormapRemoveKeyToProto(deltaOp: ORMap.RemoveKeyDeltaOp[?, ?]): rd.ORMapDeltaGroup = { ormapDeltaGroupOpsToProto(immutable.IndexedSeq(deltaOp.asInstanceOf[ORMap.DeltaOp])) } - private def ormapUpdateToProto(deltaOp: ORMap.UpdateDeltaOp[_, _]): rd.ORMapDeltaGroup = { + private def ormapUpdateToProto(deltaOp: ORMap.UpdateDeltaOp[?, ?]): rd.ORMapDeltaGroup = { ormapDeltaGroupOpsToProto(immutable.IndexedSeq(deltaOp.asInstanceOf[ORMap.DeltaOp])) } - private def ormapDeltaGroupToProto(deltaGroup: ORMap.DeltaGroup[_, _]): rd.ORMapDeltaGroup = { + private def ormapDeltaGroupToProto(deltaGroup: ORMap.DeltaGroup[?, ?]): rd.ORMapDeltaGroup = { ormapDeltaGroupOpsToProto(deltaGroup.ops) } private def ormapDeltaGroupOpsToProto(deltaGroupOps: immutable.IndexedSeq[ORMap.DeltaOp]): rd.ORMapDeltaGroup = { - def createEntry(opType: rd.ORMapDeltaOp, u: ORSet[_], m: Map[_, _], zt: Int) = { + def createEntry(opType: rd.ORMapDeltaOp, u: ORSet[?], m: Map[?, ?], zt: Int) = { if (m.size > 1 && opType != rd.ORMapDeltaOp.ORMapUpdate) throw new IllegalArgumentException("Invalid size of ORMap delta map") else { @@ -876,7 +876,7 @@ class ReplicatedDataSerializer(val system: ExtendedActorSystem) } } - def createEntryWithKey(opType: rd.ORMapDeltaOp, u: ORSet[_], k: Any, zt: Int) = { + def createEntryWithKey(opType: rd.ORMapDeltaOp, u: ORSet[?], k: Any, zt: Int) = { val entryDataBuilder = rd.ORMapDeltaGroup.MapEntry.newBuilder() k match { case key: String => entryDataBuilder.setStringKey(key) @@ -894,31 +894,31 @@ class ReplicatedDataSerializer(val system: ExtendedActorSystem) deltaGroupOps.foreach { case ORMap.PutDeltaOp(op, pair, zt) => b.addEntries( - createEntry(rd.ORMapDeltaOp.ORMapPut, op.asInstanceOf[ORSet.AddDeltaOp[_]].underlying, Map(pair), zt.value)) + createEntry(rd.ORMapDeltaOp.ORMapPut, op.asInstanceOf[ORSet.AddDeltaOp[?]].underlying, Map(pair), zt.value)) case ORMap.RemoveDeltaOp(op, zt) => b.addEntries( createEntry( rd.ORMapDeltaOp.ORMapRemove, - op.asInstanceOf[ORSet.RemoveDeltaOp[_]].underlying, + op.asInstanceOf[ORSet.RemoveDeltaOp[?]].underlying, Map.empty, zt.value)) case ORMap.RemoveKeyDeltaOp(op, k, zt) => b.addEntries( createEntryWithKey( rd.ORMapDeltaOp.ORMapRemoveKey, - op.asInstanceOf[ORSet.RemoveDeltaOp[_]].underlying, + op.asInstanceOf[ORSet.RemoveDeltaOp[?]].underlying, k, zt.value)) case ORMap.UpdateDeltaOp(op, m, zt) => b.addEntries( - createEntry(rd.ORMapDeltaOp.ORMapUpdate, op.asInstanceOf[ORSet.AddDeltaOp[_]].underlying, m, zt.value)) + createEntry(rd.ORMapDeltaOp.ORMapUpdate, op.asInstanceOf[ORSet.AddDeltaOp[?]].underlying, m, zt.value)) case ORMap.DeltaGroup(_) => throw new IllegalArgumentException("ORMap.DeltaGroup should not be nested") } b.build() } - def lwwmapToProto(lwwmap: LWWMap[_, _]): rd.LWWMap = { + def lwwmapToProto(lwwmap: LWWMap[?, ?]): rd.LWWMap = { val lwwmapBuilder = rd.LWWMap.newBuilder() val entries: jl.Iterable[rd.LWWMap.Entry] = getEntries(lwwmap.underlying.entries, rd.LWWMap.Entry.newBuilder _, lwwRegisterToProto) @@ -933,22 +933,22 @@ class ReplicatedDataSerializer(val system: ExtendedActorSystem) new LWWMap(new ORMap(keys = orsetFromProto(lwwmap.getKeys), entries, LWWMap.LWWMapTag)) } - def pncountermapToProto(pncountermap: PNCounterMap[_]): rd.PNCounterMap = { + def pncountermapToProto(pncountermap: PNCounterMap[?]): rd.PNCounterMap = { val pncountermapBuilder = rd.PNCounterMap.newBuilder() val entries: jl.Iterable[rd.PNCounterMap.Entry] = getEntries(pncountermap.underlying.entries, rd.PNCounterMap.Entry.newBuilder _, pncounterToProto) pncountermapBuilder.setKeys(orsetToProto(pncountermap.underlying.keys)).addAllEntries(entries).build() } - def pncountermapFromBinary(bytes: Array[Byte]): PNCounterMap[_] = + def pncountermapFromBinary(bytes: Array[Byte]): PNCounterMap[?] = pncountermapFromProto(rd.PNCounterMap.parseFrom(decompress(bytes))) - def pncountermapFromProto(pncountermap: rd.PNCounterMap): PNCounterMap[_] = { + def pncountermapFromProto(pncountermap: rd.PNCounterMap): PNCounterMap[?] = { val entries = mapTypeFromProto(pncountermap.getEntriesList, pncounterFromProto) new PNCounterMap(new ORMap(keys = orsetFromProto(pncountermap.getKeys), entries, PNCounterMap.PNCounterMapTag)) } - def multimapToProto(multimap: ORMultiMap[_, _]): rd.ORMultiMap = { + def multimapToProto(multimap: ORMultiMap[?, ?]): rd.ORMultiMap = { val ormultimapBuilder = rd.ORMultiMap.newBuilder() val entries: jl.Iterable[rd.ORMultiMap.Entry] = getEntries(multimap.underlying.entries, rd.ORMultiMap.Entry.newBuilder _, orsetToProto) diff --git a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/protobuf/ReplicatorMessageSerializer.scala b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/protobuf/ReplicatorMessageSerializer.scala index f5538d21c1a..980c3930463 100644 --- a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/protobuf/ReplicatorMessageSerializer.scala +++ b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/protobuf/ReplicatorMessageSerializer.scala @@ -224,14 +224,14 @@ class ReplicatorMessageSerializer(val system: ExtendedActorSystem) case _: ReadResult => ReadResultManifest case _: DeltaPropagation => DeltaPropagationManifest case _: Status => StatusManifest - case _: Get[_] => GetManifest - case _: GetSuccess[_] => GetSuccessManifest + case _: Get[?] => GetManifest + case _: GetSuccess[?] => GetSuccessManifest case _: DurableDataEnvelope => DurableDataEnvelopeManifest - case _: Changed[_] => ChangedManifest - case _: NotFound[_] => NotFoundManifest - case _: GetFailure[_] => GetFailureManifest - case _: Subscribe[_] => SubscribeManifest - case _: Unsubscribe[_] => UnsubscribeManifest + case _: Changed[?] => ChangedManifest + case _: NotFound[?] => NotFoundManifest + case _: GetFailure[?] => GetFailureManifest + case _: Subscribe[?] => SubscribeManifest + case _: Unsubscribe[?] => UnsubscribeManifest case _: Gossip => GossipManifest case WriteNack => WriteNackManifest case DeltaNack => DeltaNackManifest @@ -247,14 +247,14 @@ class ReplicatorMessageSerializer(val system: ExtendedActorSystem) case m: ReadResult => readResultToProto(m).toByteArray case m: Status => statusToProto(m).toByteArray case m: DeltaPropagation => deltaPropagationToProto(m).toByteArray - case m: Get[_] => getToProto(m).toByteArray - case m: GetSuccess[_] => getSuccessToProto(m).toByteArray + case m: Get[?] => getToProto(m).toByteArray + case m: GetSuccess[?] => getSuccessToProto(m).toByteArray case m: DurableDataEnvelope => durableDataEnvelopeToProto(m).toByteArray - case m: Changed[_] => changedToProto(m).toByteArray - case m: NotFound[_] => notFoundToProto(m).toByteArray - case m: GetFailure[_] => getFailureToProto(m).toByteArray - case m: Subscribe[_] => subscribeToProto(m).toByteArray - case m: Unsubscribe[_] => unsubscribeToProto(m).toByteArray + case m: Changed[?] => changedToProto(m).toByteArray + case m: NotFound[?] => notFoundToProto(m).toByteArray + case m: GetFailure[?] => getFailureToProto(m).toByteArray + case m: Subscribe[?] => subscribeToProto(m).toByteArray + case m: Unsubscribe[?] => unsubscribeToProto(m).toByteArray case m: Gossip => compress(gossipToProto(m)) case WriteNack => dm.Empty.getDefaultInstance.toByteArray case DeltaNack => dm.Empty.getDefaultInstance.toByteArray @@ -353,7 +353,7 @@ class ReplicatorMessageSerializer(val system: ExtendedActorSystem) }.toMap) } - private def getToProto(get: Get[_]): dm.Get = { + private def getToProto(get: Get[?]): dm.Get = { val timoutInMillis = get.consistency.timeout.toMillis require(timoutInMillis <= 0xFFFFFFFFL, "Timeouts must fit in a 32-bit unsigned int") @@ -380,7 +380,7 @@ class ReplicatorMessageSerializer(val system: ExtendedActorSystem) b.build() } - private def getFromBinary(bytes: Array[Byte]): Get[_] = { + private def getFromBinary(bytes: Array[Byte]): Get[?] = { val get = dm.Get.parseFrom(bytes) val key = otherMessageFromProto(get.getKey).asInstanceOf[KeyR] val request = if (get.hasRequest()) Some(otherMessageFromProto(get.getRequest)) else None @@ -403,7 +403,7 @@ class ReplicatorMessageSerializer(val system: ExtendedActorSystem) Get(key, consistency, request) } - private def getSuccessToProto(getSuccess: GetSuccess[_]): dm.GetSuccess = { + private def getSuccessToProto(getSuccess: GetSuccess[?]): dm.GetSuccess = { val b = dm.GetSuccess .newBuilder() .setKey(otherMessageToProto(getSuccess.key)) @@ -413,7 +413,7 @@ class ReplicatorMessageSerializer(val system: ExtendedActorSystem) b.build() } - private def getSuccessFromBinary(bytes: Array[Byte]): GetSuccess[_] = { + private def getSuccessFromBinary(bytes: Array[Byte]): GetSuccess[?] = { val getSuccess = dm.GetSuccess.parseFrom(bytes) val key = otherMessageFromProto(getSuccess.getKey).asInstanceOf[KeyR] val request = if (getSuccess.hasRequest()) Some(otherMessageFromProto(getSuccess.getRequest)) else None @@ -421,66 +421,66 @@ class ReplicatorMessageSerializer(val system: ExtendedActorSystem) GetSuccess(key, request)(data) } - private def notFoundToProto(notFound: NotFound[_]): dm.NotFound = { + private def notFoundToProto(notFound: NotFound[?]): dm.NotFound = { val b = dm.NotFound.newBuilder().setKey(otherMessageToProto(notFound.key)) notFound.request.foreach(o => b.setRequest(otherMessageToProto(o))) b.build() } - private def notFoundFromBinary(bytes: Array[Byte]): NotFound[_] = { + private def notFoundFromBinary(bytes: Array[Byte]): NotFound[?] = { val notFound = dm.NotFound.parseFrom(bytes) val request = if (notFound.hasRequest()) Some(otherMessageFromProto(notFound.getRequest)) else None val key = otherMessageFromProto(notFound.getKey).asInstanceOf[KeyR] NotFound(key, request) } - private def getFailureToProto(getFailure: GetFailure[_]): dm.GetFailure = { + private def getFailureToProto(getFailure: GetFailure[?]): dm.GetFailure = { val b = dm.GetFailure.newBuilder().setKey(otherMessageToProto(getFailure.key)) getFailure.request.foreach(o => b.setRequest(otherMessageToProto(o))) b.build() } - private def getFailureFromBinary(bytes: Array[Byte]): GetFailure[_] = { + private def getFailureFromBinary(bytes: Array[Byte]): GetFailure[?] = { val getFailure = dm.GetFailure.parseFrom(bytes) val request = if (getFailure.hasRequest()) Some(otherMessageFromProto(getFailure.getRequest)) else None val key = otherMessageFromProto(getFailure.getKey).asInstanceOf[KeyR] GetFailure(key, request) } - private def subscribeToProto(subscribe: Subscribe[_]): dm.Subscribe = + private def subscribeToProto(subscribe: Subscribe[?]): dm.Subscribe = dm.Subscribe .newBuilder() .setKey(otherMessageToProto(subscribe.key)) .setRef(Serialization.serializedActorPath(subscribe.subscriber)) .build() - private def subscribeFromBinary(bytes: Array[Byte]): Subscribe[_] = { + private def subscribeFromBinary(bytes: Array[Byte]): Subscribe[?] = { val subscribe = dm.Subscribe.parseFrom(bytes) val key = otherMessageFromProto(subscribe.getKey).asInstanceOf[KeyR] Subscribe(key, resolveActorRef(subscribe.getRef)) } - private def unsubscribeToProto(unsubscribe: Unsubscribe[_]): dm.Unsubscribe = + private def unsubscribeToProto(unsubscribe: Unsubscribe[?]): dm.Unsubscribe = dm.Unsubscribe .newBuilder() .setKey(otherMessageToProto(unsubscribe.key)) .setRef(Serialization.serializedActorPath(unsubscribe.subscriber)) .build() - private def unsubscribeFromBinary(bytes: Array[Byte]): Unsubscribe[_] = { + private def unsubscribeFromBinary(bytes: Array[Byte]): Unsubscribe[?] = { val unsubscribe = dm.Unsubscribe.parseFrom(bytes) val key = otherMessageFromProto(unsubscribe.getKey).asInstanceOf[KeyR] Unsubscribe(key, resolveActorRef(unsubscribe.getRef)) } - private def changedToProto(changed: Changed[_]): dm.Changed = + private def changedToProto(changed: Changed[?]): dm.Changed = dm.Changed .newBuilder() .setKey(otherMessageToProto(changed.key)) .setData(otherMessageToProto(changed.dataValue)) .build() - private def changedFromBinary(bytes: Array[Byte]): Changed[_] = { + private def changedFromBinary(bytes: Array[Byte]): Changed[?] = { val changed = dm.Changed.parseFrom(bytes) val data = otherMessageFromProto(changed.getData).asInstanceOf[ReplicatedData] val key = otherMessageFromProto(changed.getKey).asInstanceOf[KeyR] diff --git a/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/JepsenInspiredInsertSpec.scala b/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/JepsenInspiredInsertSpec.scala index 6674c52df25..3cfa058864b 100644 --- a/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/JepsenInspiredInsertSpec.scala +++ b/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/JepsenInspiredInsertSpec.scala @@ -135,8 +135,8 @@ class JepsenInspiredInsertSpec replicator.tell(Update(key, ORSet(), WriteLocal, Some(i))(_ :+ i), writeProbe.ref) writeProbe.receiveOne(3.seconds) } - val successWriteAcks = writeAcks.collect { case success: UpdateSuccess[_] => success } - val failureWriteAcks = writeAcks.collect { case fail: UpdateFailure[_] => fail } + val successWriteAcks = writeAcks.collect { case success: UpdateSuccess[?] => success } + val failureWriteAcks = writeAcks.collect { case fail: UpdateFailure[?] => fail } successWriteAcks.map(_.request.get).toSet should be(myData.toSet) successWriteAcks.size should be(myData.size) failureWriteAcks should be(Nil) @@ -168,8 +168,8 @@ class JepsenInspiredInsertSpec replicator.tell(Update(key, ORSet(), writeMajority, Some(i))(_ :+ i), writeProbe.ref) writeProbe.receiveOne(timeout + 1.second) } - val successWriteAcks = writeAcks.collect { case success: UpdateSuccess[_] => success } - val failureWriteAcks = writeAcks.collect { case fail: UpdateFailure[_] => fail } + val successWriteAcks = writeAcks.collect { case success: UpdateSuccess[?] => success } + val failureWriteAcks = writeAcks.collect { case fail: UpdateFailure[?] => fail } successWriteAcks.map(_.request.get).toSet should be(myData.toSet) successWriteAcks.size should be(myData.size) failureWriteAcks should be(Nil) @@ -212,8 +212,8 @@ class JepsenInspiredInsertSpec replicator.tell(Update(key, ORSet(), WriteLocal, Some(i))(_ :+ i), writeProbe.ref) writeProbe.receiveOne(3.seconds) } - val successWriteAcks = writeAcks.collect { case success: UpdateSuccess[_] => success } - val failureWriteAcks = writeAcks.collect { case fail: UpdateFailure[_] => fail } + val successWriteAcks = writeAcks.collect { case success: UpdateSuccess[?] => success } + val failureWriteAcks = writeAcks.collect { case fail: UpdateFailure[?] => fail } successWriteAcks.map(_.request.get).toSet should be(myData.toSet) successWriteAcks.size should be(myData.size) failureWriteAcks should be(Nil) @@ -257,8 +257,8 @@ class JepsenInspiredInsertSpec replicator.tell(Update(key, ORSet(), writeMajority, Some(i))(_ :+ i), writeProbe.ref) writeProbe.receiveOne(timeout + 1.second) } - val successWriteAcks = writeAcks.collect { case success: UpdateSuccess[_] => success } - val failureWriteAcks = writeAcks.collect { case fail: UpdateFailure[_] => fail } + val successWriteAcks = writeAcks.collect { case success: UpdateSuccess[?] => success } + val failureWriteAcks = writeAcks.collect { case fail: UpdateFailure[?] => fail } runOn(n1, n4, n5) { successWriteAcks.map(_.request.get).toSet should be(myData.toSet) successWriteAcks.size should be(myData.size) diff --git a/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorChaosSpec.scala b/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorChaosSpec.scala index c59c755d666..d0197a3a7c3 100644 --- a/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorChaosSpec.scala +++ b/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorChaosSpec.scala @@ -85,8 +85,8 @@ class ReplicatorChaosSpec extends MultiNodeSpec(ReplicatorChaosSpec) with STMult g.dataValue match { case c: GCounter => c.value case c: PNCounter => c.value - case c: GSet[_] => c.elements - case c: ORSet[_] => c.elements + case c: GSet[?] => c.elements + case c: ORSet[?] => c.elements case _ => fail() } } @@ -125,7 +125,7 @@ class ReplicatorChaosSpec extends MultiNodeSpec(ReplicatorChaosSpec) with STMult replicator ! Update(KeyB, PNCounter(), WriteLocal)(_.decrement(1)) replicator ! Update(KeyC, GCounter(), WriteAll(timeout))(_ :+ 1) } - receiveN(15).map(_.getClass).toSet should be(Set(classOf[UpdateSuccess[_]])) + receiveN(15).map(_.getClass).toSet should be(Set(classOf[UpdateSuccess[?]])) } runOn(second) { diff --git a/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorDeltaSpec.scala b/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorDeltaSpec.scala index 41f60b961f2..50cd1edfe66 100644 --- a/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorDeltaSpec.scala +++ b/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorDeltaSpec.scala @@ -251,8 +251,8 @@ class ReplicatorDeltaSpec extends MultiNodeSpec(ReplicatorDeltaSpec) with STMult val p1 = TestProbe() fullStateReplicator.tell(Update(KeyD, ORSet.empty[String], writeAll)(_ :+ "A"), p1.ref) deltaReplicator.tell(Update(KeyD, ORSet.empty[String], writeAll)(_ :+ "A"), p1.ref) - p1.expectMsgType[UpdateSuccess[_]] - p1.expectMsgType[UpdateSuccess[_]] + p1.expectMsgType[UpdateSuccess[?]] + p1.expectMsgType[UpdateSuccess[?]] } enterBarrier("write-1") @@ -268,9 +268,9 @@ class ReplicatorDeltaSpec extends MultiNodeSpec(ReplicatorDeltaSpec) with STMult deltaReplicator.tell(Update(KeyD, ORSet.empty[String], writeAll)(_ :+ "B"), p1.ref) deltaReplicator.tell(Update(KeyD, ORSet.empty[String], writeAll)(_ :+ "C"), p1.ref) deltaReplicator.tell(Update(KeyD, ORSet.empty[String], writeAll)(_ :+ "D"), p1.ref) - p1.expectMsgType[UpdateSuccess[_]] - p1.expectMsgType[UpdateSuccess[_]] - p1.expectMsgType[UpdateSuccess[_]] + p1.expectMsgType[UpdateSuccess[?]] + p1.expectMsgType[UpdateSuccess[?]] + p1.expectMsgType[UpdateSuccess[?]] } enterBarrier("write-2") deltaReplicator.tell(Get(KeyD, ReadLocal), p.ref) @@ -280,7 +280,7 @@ class ReplicatorDeltaSpec extends MultiNodeSpec(ReplicatorDeltaSpec) with STMult runOn(first) { val p1 = TestProbe() fullStateReplicator.tell(Update(KeyD, ORSet.empty[String], writeAll)(_ :+ "A" :+ "B" :+ "C" :+ "D"), p1.ref) - p1.expectMsgType[UpdateSuccess[_]] + p1.expectMsgType[UpdateSuccess[?]] } enterBarrier("write-3") fullStateReplicator.tell(Get(KeyD, ReadLocal), p.ref) @@ -293,7 +293,7 @@ class ReplicatorDeltaSpec extends MultiNodeSpec(ReplicatorDeltaSpec) with STMult runOn(first) { val p1 = TestProbe() deltaReplicator.tell(Update(KeyHigh, Highest(0), WriteLocal)(_.incr(1)), p1.ref) - p1.expectMsgType[UpdateSuccess[_]] + p1.expectMsgType[UpdateSuccess[?]] } enterBarrier("write-1") @@ -316,11 +316,11 @@ class ReplicatorDeltaSpec extends MultiNodeSpec(ReplicatorDeltaSpec) with STMult runOn(first) { val p1 = TestProbe() deltaReplicator.tell(Update(KeyHigh, Highest(0), writeAll)(_.incr(2)), p1.ref) - p1.expectMsgType[UpdateSuccess[_]] + p1.expectMsgType[UpdateSuccess[?]] deltaReplicator.tell(Update(KeyHigh, Highest(0), WriteLocal)(_.incrNoDelta(5)), p1.ref) deltaReplicator.tell(Update(KeyHigh, Highest(0), WriteLocal)(_.incr(10)), p1.ref) - p1.expectMsgType[UpdateSuccess[_]] - p1.expectMsgType[UpdateSuccess[_]] + p1.expectMsgType[UpdateSuccess[?]] + p1.expectMsgType[UpdateSuccess[?]] } enterBarrier("write-2") @@ -347,7 +347,7 @@ class ReplicatorDeltaSpec extends MultiNodeSpec(ReplicatorDeltaSpec) with STMult // delta versions again. Same would happen via full state gossip. // Thereafter delta can be propagated and applied again. deltaReplicator.tell(Update(KeyHigh, Highest(0), writeAll)(_.incr(100)), p1.ref) - p1.expectMsgType[UpdateSuccess[_]] + p1.expectMsgType[UpdateSuccess[?]] // Flush the deltaPropagation buffer, otherwise it will contain // NoDeltaPlaceholder from previous updates and the incr(4) delta will also // be folded into NoDeltaPlaceholder and not propagated as delta. A few DeltaPropagationTick @@ -356,7 +356,7 @@ class ReplicatorDeltaSpec extends MultiNodeSpec(ReplicatorDeltaSpec) with STMult deltaReplicator ! Replicator.Internal.DeltaPropagationTick } deltaReplicator.tell(Update(KeyHigh, Highest(0), WriteLocal)(_.incr(4)), p1.ref) - p1.expectMsgType[UpdateSuccess[_]] + p1.expectMsgType[UpdateSuccess[?]] } enterBarrier("write-3") diff --git a/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorGossipSpec.scala b/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorGossipSpec.scala index a2a9bf4d96b..25f882404df 100644 --- a/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorGossipSpec.scala +++ b/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorGossipSpec.scala @@ -93,11 +93,11 @@ class ReplicatorGossipSpec extends MultiNodeSpec(ReplicatorGossipSpec) with STMu runOn(first) { (0 until numberOfSmall).foreach { i => replicator ! Update(smallORSetKeys(i), ORSet.empty[String], WriteLocal)(_ :+ smallPayload()) - expectMsgType[UpdateSuccess[_]] + expectMsgType[UpdateSuccess[?]] } (0 until numberOfLarge).foreach { i => replicator ! Update(largeORSetKeys(i), ORSet.empty[String], WriteLocal)(_ :+ largePayload()) - expectMsgType[UpdateSuccess[_]] + expectMsgType[UpdateSuccess[?]] } } enterBarrier("updated-first") diff --git a/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorORSetDeltaSpec.scala b/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorORSetDeltaSpec.scala index 638feb968d2..58b4a7bf4e5 100644 --- a/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorORSetDeltaSpec.scala +++ b/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorORSetDeltaSpec.scala @@ -76,7 +76,7 @@ class ReplicatorORSetDeltaSpec val value = expectMsgPF() { case g @ GetSuccess(`key`, _) => g.dataValue match { - case c: ORSet[_] => c.elements + case c: ORSet[?] => c.elements case _ => fail() } } diff --git a/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorSpec.scala b/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorSpec.scala index 47cd9177c65..09985c51cc9 100644 --- a/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorSpec.scala +++ b/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorSpec.scala @@ -205,7 +205,7 @@ class ReplicatorSpec extends MultiNodeSpec(ReplicatorSpec) with STMultiNodeSpec "reply with ModifyFailure if exception is thrown by modify function" in { val e = new RuntimeException("errr") replicator ! Update(KeyA, GCounter(), WriteLocal)(_ => throw e) - expectMsgType[ModifyFailure[_]].cause should be(e) + expectMsgType[ModifyFailure[?]].cause should be(e) } "replicate values to new node" in { @@ -459,7 +459,7 @@ class ReplicatorSpec extends MultiNodeSpec(ReplicatorSpec) with STMultiNodeSpec val probe1 = TestProbe() val probe2 = TestProbe() replicator.tell(Get(KeyE, readMajority), probe2.ref) - probe2.expectMsgType[GetSuccess[_]] + probe2.expectMsgType[GetSuccess[?]] replicator.tell(Update(KeyE, GCounter(), writeMajority, None) { data => probe1.ref ! data.value data :+ 1 @@ -478,7 +478,7 @@ class ReplicatorSpec extends MultiNodeSpec(ReplicatorSpec) with STMultiNodeSpec runOn(second) { val probe1 = TestProbe() replicator.tell(Get(KeyE, readMajority), probe1.ref) - probe1.expectMsgType[GetSuccess[_]] + probe1.expectMsgType[GetSuccess[?]] replicator.tell(Update(KeyE, GCounter(), writeMajority, Some(153))(_ :+ 1), probe1.ref) // verify read your own writes, without waiting for the UpdateSuccess reply // note that the order of the replies are not defined, and therefore we use separate probes @@ -527,7 +527,7 @@ class ReplicatorSpec extends MultiNodeSpec(ReplicatorSpec) with STMultiNodeSpec replicator ! Update(KeyF, GCounter(), writeTwo)(_ :+ 1) } val results = receiveN(100) - results.map(_.getClass).toSet should be(Set(classOf[UpdateSuccess[_]])) + results.map(_.getClass).toSet should be(Set(classOf[UpdateSuccess[?]])) } enterBarrier("100-updates-done") runOn(first, second, third) { @@ -541,7 +541,7 @@ class ReplicatorSpec extends MultiNodeSpec(ReplicatorSpec) with STMultiNodeSpec "read-repair happens before GetSuccess" in { runOn(first) { replicator ! Update(KeyG, ORSet(), writeTwo)(_ :+ "a" :+ "b") - expectMsgType[UpdateSuccess[_]] + expectMsgType[UpdateSuccess[?]] } enterBarrier("a-b-added-to-G") runOn(second) { diff --git a/distributed-data/src/test/scala/org/apache/pekko/cluster/ddata/LocalConcurrencySpec.scala b/distributed-data/src/test/scala/org/apache/pekko/cluster/ddata/LocalConcurrencySpec.scala index ceb966f5455..93627d75c58 100644 --- a/distributed-data/src/test/scala/org/apache/pekko/cluster/ddata/LocalConcurrencySpec.scala +++ b/distributed-data/src/test/scala/org/apache/pekko/cluster/ddata/LocalConcurrencySpec.scala @@ -87,7 +87,7 @@ class LocalConcurrencySpec(_system: ActorSystem) val expected = ((1 to numMessages).map("a" + _) ++ (1 to numMessages).map("b" + _)).toSet awaitAssert { replicator ! Replicator.Get(Updater.key, Replicator.ReadLocal) - val elements = expectMsgType[Replicator.GetSuccess[_]].get(Updater.key) match { + val elements = expectMsgType[Replicator.GetSuccess[?]].get(Updater.key) match { case ORSet(e) => e case _ => fail() } diff --git a/distributed-data/src/test/scala/org/apache/pekko/cluster/ddata/LotsOfDataBot.scala b/distributed-data/src/test/scala/org/apache/pekko/cluster/ddata/LotsOfDataBot.scala index 35af027f834..fb63a490489 100644 --- a/distributed-data/src/test/scala/org/apache/pekko/cluster/ddata/LotsOfDataBot.scala +++ b/distributed-data/src/test/scala/org/apache/pekko/cluster/ddata/LotsOfDataBot.scala @@ -122,7 +122,7 @@ class LotsOfDataBot extends Actor with ActorLogging { } } - case _: UpdateResponse[_] => // ignore + case _: UpdateResponse[?] => // ignore case c @ Changed(ORSetKey(id)) => val elements = c.dataValue match { case ORSet(e) => e diff --git a/docs/src/test/scala/docs/actor/SharedMutableStateDocSpec.scala b/docs/src/test/scala/docs/actor/SharedMutableStateDocSpec.scala index a77345d1905..75613353d76 100644 --- a/docs/src/test/scala/docs/actor/SharedMutableStateDocSpec.scala +++ b/docs/src/test/scala/docs/actor/SharedMutableStateDocSpec.scala @@ -34,7 +34,7 @@ class SharedMutableStateDocSpec { class CleanUpActor extends Actor { def receive = { - case set: mutable.Set[_] => set.clear() + case set: mutable.Set[?] => set.clear() } } diff --git a/docs/src/test/scala/docs/ddata/DistributedDataDocSpec.scala b/docs/src/test/scala/docs/ddata/DistributedDataDocSpec.scala index 16de186455e..3363ac3a94a 100644 --- a/docs/src/test/scala/docs/ddata/DistributedDataDocSpec.scala +++ b/docs/src/test/scala/docs/ddata/DistributedDataDocSpec.scala @@ -95,7 +95,7 @@ object DistributedDataDocSpec { replicator ! Update(DataKey, ORSet.empty[String], WriteLocal)(_.remove(s)) } - case _: UpdateResponse[_] => // ignore + case _: UpdateResponse[?] => // ignore case c @ Changed(DataKey) => val data = c.get(DataKey) log.info("Current elements: {}", data.elements) @@ -136,14 +136,14 @@ class DistributedDataDocSpec extends PekkoSpec(DistributedDataDocSpec.config) { replicator ! Update(ActiveFlagKey, Flag.Disabled, writeAll)(_.switchOn) // #update - probe.expectMsgType[UpdateResponse[_]] match { + probe.expectMsgType[UpdateResponse[?]] match { // #update-response1 case UpdateSuccess(Counter1Key, req) => // ok // #update-response1 case unexpected => fail("Unexpected response: " + unexpected) } - probe.expectMsgType[UpdateResponse[_]] match { + probe.expectMsgType[UpdateResponse[?]] match { // #update-response2 case UpdateSuccess(Set1Key, req) => // ok case UpdateTimeout(Set1Key, req) => @@ -203,7 +203,7 @@ class DistributedDataDocSpec extends PekkoSpec(DistributedDataDocSpec.config) { replicator ! Get(ActiveFlagKey, readAll) // #get - probe.expectMsgType[GetResponse[_]] match { + probe.expectMsgType[GetResponse[?]] match { // #get-response1 case g @ GetSuccess(Counter1Key, req) => val value = g.get(Counter1Key).value @@ -212,7 +212,7 @@ class DistributedDataDocSpec extends PekkoSpec(DistributedDataDocSpec.config) { case unexpected => fail("Unexpected response: " + unexpected) } - probe.expectMsgType[GetResponse[_]] match { + probe.expectMsgType[GetResponse[?]] match { // #get-response2 case g @ GetSuccess(Set1Key, req) => val elements = g.get(Set1Key).elements diff --git a/docs/src/test/scala/docs/ddata/ShoppingCart.scala b/docs/src/test/scala/docs/ddata/ShoppingCart.scala index ffb9c2e65ab..d0ef12f8c6f 100644 --- a/docs/src/test/scala/docs/ddata/ShoppingCart.scala +++ b/docs/src/test/scala/docs/ddata/ShoppingCart.scala @@ -118,9 +118,9 @@ class ShoppingCart(userId: String) extends Actor { // #remove-item def receiveOther: Receive = { - case _: UpdateSuccess[_] | _: UpdateTimeout[_] => + case _: UpdateSuccess[?] | _: UpdateTimeout[?] => // UpdateTimeout, will eventually be replicated - case e: UpdateFailure[_] => throw new IllegalStateException("Unexpected failure: " + e) + case e: UpdateFailure[?] => throw new IllegalStateException("Unexpected failure: " + e) } } diff --git a/docs/src/test/scala/docs/ddata/protobuf/TwoPhaseSetSerializer.scala b/docs/src/test/scala/docs/ddata/protobuf/TwoPhaseSetSerializer.scala index 44931d3ac3a..0bc0376639a 100644 --- a/docs/src/test/scala/docs/ddata/protobuf/TwoPhaseSetSerializer.scala +++ b/docs/src/test/scala/docs/ddata/protobuf/TwoPhaseSetSerializer.scala @@ -36,7 +36,7 @@ class TwoPhaseSetSerializer(val system: ExtendedActorSystem) extends Serializer case _ => throw new IllegalArgumentException(s"Can't serialize object of type ${obj.getClass}") } - override def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = { + override def fromBinary(bytes: Array[Byte], clazz: Option[Class[?]]): AnyRef = { twoPhaseSetFromBinary(bytes) } @@ -78,7 +78,7 @@ class TwoPhaseSetSerializerWithCompression(system: ExtendedActorSystem) extends case _ => throw new IllegalArgumentException(s"Can't serialize object of type ${obj.getClass}") } - override def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = { + override def fromBinary(bytes: Array[Byte], clazz: Option[Class[?]]): AnyRef = { twoPhaseSetFromBinary(decompress(bytes)) } // #compression diff --git a/docs/src/test/scala/docs/ddata/protobuf/TwoPhaseSetSerializer2.scala b/docs/src/test/scala/docs/ddata/protobuf/TwoPhaseSetSerializer2.scala index 89eae2ae9f5..2760a7c33eb 100644 --- a/docs/src/test/scala/docs/ddata/protobuf/TwoPhaseSetSerializer2.scala +++ b/docs/src/test/scala/docs/ddata/protobuf/TwoPhaseSetSerializer2.scala @@ -33,7 +33,7 @@ class TwoPhaseSetSerializer2(val system: ExtendedActorSystem) extends Serializer case _ => throw new IllegalArgumentException(s"Can't serialize object of type ${obj.getClass}") } - override def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = { + override def fromBinary(bytes: Array[Byte], clazz: Option[Class[?]]): AnyRef = { twoPhaseSetFromBinary(bytes) } diff --git a/docs/src/test/scala/docs/event/LoggingDocSpec.scala b/docs/src/test/scala/docs/event/LoggingDocSpec.scala index cc36f7957f1..6dafb0db6d8 100644 --- a/docs/src/test/scala/docs/event/LoggingDocSpec.scala +++ b/docs/src/test/scala/docs/event/LoggingDocSpec.scala @@ -112,7 +112,7 @@ object LoggingDocSpec { object MyType { implicit val logSource: LogSource[AnyRef] = new LogSource[AnyRef] { def genString(o: AnyRef): String = o.getClass.getName - override def getClazz(o: AnyRef): Class[_] = o.getClass + override def getClazz(o: AnyRef): Class[?] = o.getClass } } diff --git a/docs/src/test/scala/docs/io/EchoServer.scala b/docs/src/test/scala/docs/io/EchoServer.scala index 0df40557238..1df76a4f7c4 100644 --- a/docs/src/test/scala/docs/io/EchoServer.scala +++ b/docs/src/test/scala/docs/io/EchoServer.scala @@ -35,7 +35,7 @@ object EchoServer extends App { system.terminate() } -class EchoManager(handlerClass: Class[_]) extends Actor with ActorLogging { +class EchoManager(handlerClass: Class[?]) extends Actor with ActorLogging { import Tcp._ import context.system diff --git a/docs/src/test/scala/docs/persistence/PersistenceSerializerDocSpec.scala b/docs/src/test/scala/docs/persistence/PersistenceSerializerDocSpec.scala index 819151b36b6..b41f8fedb7b 100644 --- a/docs/src/test/scala/docs/persistence/PersistenceSerializerDocSpec.scala +++ b/docs/src/test/scala/docs/persistence/PersistenceSerializerDocSpec.scala @@ -54,12 +54,12 @@ class MyPayloadSerializer extends Serializer { def identifier: Int = 77124 def includeManifest: Boolean = false def toBinary(o: AnyRef): Array[Byte] = ??? - def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = ??? + def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = ??? } class MySnapshotSerializer extends Serializer { def identifier: Int = 77125 def includeManifest: Boolean = false def toBinary(o: AnyRef): Array[Byte] = ??? - def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = ??? + def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = ??? } diff --git a/docs/src/test/scala/docs/serialization/SerializationDocSpec.scala b/docs/src/test/scala/docs/serialization/SerializationDocSpec.scala index ab58efde98c..fc5ca47363e 100644 --- a/docs/src/test/scala/docs/serialization/SerializationDocSpec.scala +++ b/docs/src/test/scala/docs/serialization/SerializationDocSpec.scala @@ -53,7 +53,7 @@ package docs.serialization { // "fromBinary" deserializes the given array, // using the type hint (if any, see "includeManifest" above) - def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = { + def fromBinary(bytes: Array[Byte], clazz: Option[Class[?]]): AnyRef = { // Put your code that deserializes here // #... null diff --git a/docs/src/test/scala/docs/stream/GraphDSLDocSpec.scala b/docs/src/test/scala/docs/stream/GraphDSLDocSpec.scala index 5d7c2045d12..bd63246f623 100644 --- a/docs/src/test/scala/docs/stream/GraphDSLDocSpec.scala +++ b/docs/src/test/scala/docs/stream/GraphDSLDocSpec.scala @@ -110,9 +110,9 @@ class GraphDSLDocSpec extends PekkoSpec { // It is important to provide the list of all input and output // ports with a stable order. Duplicates are not allowed. - override val inlets: immutable.Seq[Inlet[_]] = + override val inlets: immutable.Seq[Inlet[?]] = jobsIn :: priorityJobsIn :: Nil - override val outlets: immutable.Seq[Outlet[_]] = + override val outlets: immutable.Seq[Outlet[?]] = resultsOut :: Nil // A Shape must be able to create a copy of itself. Basically diff --git a/docs/src/test/scala/docs/stream/cookbook/RecipeAdhocSource.scala b/docs/src/test/scala/docs/stream/cookbook/RecipeAdhocSource.scala index 6360e2f4fe1..11325b65565 100644 --- a/docs/src/test/scala/docs/stream/cookbook/RecipeAdhocSource.scala +++ b/docs/src/test/scala/docs/stream/cookbook/RecipeAdhocSource.scala @@ -27,7 +27,7 @@ import scala.concurrent.duration._ class RecipeAdhocSource extends RecipeSpec { // #adhoc-source - def adhocSource[T](source: Source[T, _], timeout: FiniteDuration, maxRetries: Int): Source[T, _] = + def adhocSource[T](source: Source[T, ?], timeout: FiniteDuration, maxRetries: Int): Source[T, ?] = Source.lazySource(() => source .backpressureTimeout(timeout) diff --git a/docs/src/test/scala/docs/stream/operators/source/Zip.scala b/docs/src/test/scala/docs/stream/operators/source/Zip.scala index 14b67bb03ee..1a6056522eb 100644 --- a/docs/src/test/scala/docs/stream/operators/source/Zip.scala +++ b/docs/src/test/scala/docs/stream/operators/source/Zip.scala @@ -18,7 +18,7 @@ import org.apache.pekko.stream.scaladsl.Source object Zip { - implicit val system: ActorSystem[_] = ??? + implicit val system: ActorSystem[?] = ??? def zipN(): Unit = { // #zipN-simple diff --git a/docs/src/test/scala/docs/stream/operators/sourceorflow/Limit.scala b/docs/src/test/scala/docs/stream/operators/sourceorflow/Limit.scala index 159ba26f014..1bfdd2e8a60 100644 --- a/docs/src/test/scala/docs/stream/operators/sourceorflow/Limit.scala +++ b/docs/src/test/scala/docs/stream/operators/sourceorflow/Limit.scala @@ -22,7 +22,7 @@ import scala.concurrent.Future object Limit { - implicit val system: ActorSystem[_] = ??? + implicit val system: ActorSystem[?] = ??? def simple(): Unit = { // #simple diff --git a/docs/src/test/scala/docs/stream/operators/sourceorflow/LimitWeighted.scala b/docs/src/test/scala/docs/stream/operators/sourceorflow/LimitWeighted.scala index c604a2322c2..e2c3ed83841 100644 --- a/docs/src/test/scala/docs/stream/operators/sourceorflow/LimitWeighted.scala +++ b/docs/src/test/scala/docs/stream/operators/sourceorflow/LimitWeighted.scala @@ -22,7 +22,7 @@ import scala.concurrent.Future object LimitWeighted { - implicit val system: ActorSystem[_] = ??? + implicit val system: ActorSystem[?] = ??? def simple(): Unit = { // #simple diff --git a/multi-node-testkit/src/main/scala/org/apache/pekko/remote/testconductor/Player.scala b/multi-node-testkit/src/main/scala/org/apache/pekko/remote/testconductor/Player.scala index 570be3b53b4..54b77dd695b 100644 --- a/multi-node-testkit/src/main/scala/org/apache/pekko/remote/testconductor/Player.scala +++ b/multi-node-testkit/src/main/scala/org/apache/pekko/remote/testconductor/Player.scala @@ -56,11 +56,11 @@ object Player { case Transition(_, f: ClientFSM.State, t: ClientFSM.State) if f == AwaitDone && t == Connected => // SI-5900 workaround waiting ! Done; context.stop(self) - case t: Transition[_] => + case t: Transition[?] => waiting ! Status.Failure(new RuntimeException("unexpected transition: " + t)); context.stop(self) case CurrentState(_, s: ClientFSM.State) if s == Connected => // SI-5900 workaround waiting ! Done; context.stop(self) - case _: CurrentState[_] => + case _: CurrentState[?] => } } diff --git a/multi-node-testkit/src/main/scala/org/apache/pekko/remote/testkit/MultiNodeSpec.scala b/multi-node-testkit/src/main/scala/org/apache/pekko/remote/testkit/MultiNodeSpec.scala index 95f6a3f1df9..7125e66318b 100644 --- a/multi-node-testkit/src/main/scala/org/apache/pekko/remote/testkit/MultiNodeSpec.scala +++ b/multi-node-testkit/src/main/scala/org/apache/pekko/remote/testkit/MultiNodeSpec.scala @@ -464,9 +464,9 @@ abstract class MultiNodeSpec( */ def node(role: RoleName): ActorPath = RootActorPath(testConductor.getAddressFor(role).await) - def muteDeadLetters(messageClasses: Class[_]*)(sys: ActorSystem = system): Unit = + def muteDeadLetters(messageClasses: Class[?]*)(sys: ActorSystem = system): Unit = if (!sys.log.isDebugEnabled) { - def mute(clazz: Class[_]): Unit = + def mute(clazz: Class[?]): Unit = sys.eventStream.publish(Mute(DeadLettersFilter(clazz)(occurrences = Int.MaxValue))) if (messageClasses.isEmpty) mute(classOf[AnyRef]) else messageClasses.foreach(mute) 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 12536c0326d..cd8dd8d647f 100644 --- a/osgi/src/main/scala/org/apache/pekko/osgi/ActorSystemActivator.scala +++ b/osgi/src/main/scala/org/apache/pekko/osgi/ActorSystemActivator.scala @@ -35,7 +35,7 @@ import pekko.util.unused abstract class ActorSystemActivator extends BundleActivator { private var system: Option[ActorSystem] = None - private var registration: Option[ServiceRegistration[_]] = None + private var registration: Option[ServiceRegistration[?]] = None /** * Implement this method to add your own actors to the ActorSystem. If you want to share the actor @@ -88,7 +88,7 @@ abstract class ActorSystemActivator extends BundleActivator { /** * Convenience method to find a service by its reference. */ - def serviceForReference[T](context: BundleContext, reference: ServiceReference[_]): T = + def serviceForReference[T](context: BundleContext, reference: ServiceReference[?]): T = context.getService(reference).asInstanceOf[T] /** diff --git a/osgi/src/main/scala/org/apache/pekko/osgi/BundleDelegatingClassLoader.scala b/osgi/src/main/scala/org/apache/pekko/osgi/BundleDelegatingClassLoader.scala index 45c8bd99342..e9357fd873a 100644 --- a/osgi/src/main/scala/org/apache/pekko/osgi/BundleDelegatingClassLoader.scala +++ b/osgi/src/main/scala/org/apache/pekko/osgi/BundleDelegatingClassLoader.scala @@ -50,8 +50,8 @@ class BundleDelegatingClassLoader(bundle: Bundle, fallBackClassLoader: ClassLoad private val bundles = findTransitiveBundles(bundle).toList - override def findClass(name: String): Class[_] = { - @tailrec def find(remaining: List[Bundle]): Class[_] = { + override def findClass(name: String): Class[?] = { + @tailrec def find(remaining: List[Bundle]): Class[?] = { if (remaining.isEmpty) throw new ClassNotFoundException(name) else Try { remaining.head.loadClass(name) } match { diff --git a/osgi/src/test/scala/org/apache/pekko/osgi/PojoSRTestSupport.scala b/osgi/src/test/scala/org/apache/pekko/osgi/PojoSRTestSupport.scala index 68200756fff..7caa920128c 100644 --- a/osgi/src/test/scala/org/apache/pekko/osgi/PojoSRTestSupport.scala +++ b/osgi/src/test/scala/org/apache/pekko/osgi/PojoSRTestSupport.scala @@ -150,7 +150,7 @@ class BundleDescriptorBuilder(name: String) { /** * Add a Bundle activator to our test bundle */ - def withActivator(activator: Class[_ <: BundleActivator]): BundleDescriptorBuilder = { + def withActivator(activator: Class[? <: BundleActivator]): BundleDescriptorBuilder = { tinybundle.set(Constants.BUNDLE_ACTIVATOR, activator.getName) this } diff --git a/persistence-query/src/main/scala/org/apache/pekko/persistence/query/internal/QuerySerializer.scala b/persistence-query/src/main/scala/org/apache/pekko/persistence/query/internal/QuerySerializer.scala index a4f2dee8673..7470b93f7fc 100644 --- a/persistence-query/src/main/scala/org/apache/pekko/persistence/query/internal/QuerySerializer.scala +++ b/persistence-query/src/main/scala/org/apache/pekko/persistence/query/internal/QuerySerializer.scala @@ -60,14 +60,14 @@ import pekko.serialization.Serializers private val timestampOffsetSeparator = ';' override def manifest(o: AnyRef): String = o match { - case _: EventEnvelope[_] => EventEnvelopeManifest + case _: EventEnvelope[?] => EventEnvelopeManifest case offset: Offset => toStorageRepresentation(offset)._2 case _ => throw new IllegalArgumentException(s"Can't serialize object of type ${o.getClass} in [${getClass.getName}]") } override def toBinary(o: AnyRef): Array[Byte] = o match { - case env: EventEnvelope[_] => + case env: EventEnvelope[?] => val builder = QueryMessages.EventEnvelope.newBuilder() val (offset, offsetManifest) = toStorageRepresentation(env.offset) diff --git a/persistence-query/src/main/scala/org/apache/pekko/persistence/query/journal/leveldb/AllPersistenceIdsStage.scala b/persistence-query/src/main/scala/org/apache/pekko/persistence/query/journal/leveldb/AllPersistenceIdsStage.scala index e008b1abcb8..011853a8b63 100644 --- a/persistence-query/src/main/scala/org/apache/pekko/persistence/query/journal/leveldb/AllPersistenceIdsStage.scala +++ b/persistence-query/src/main/scala/org/apache/pekko/persistence/query/journal/leveldb/AllPersistenceIdsStage.scala @@ -46,7 +46,7 @@ final private[pekko] class AllPersistenceIdsStage(liveQuery: Boolean, writeJourn val journal: ActorRef = Persistence(mat.system).journalFor(writeJournalPluginId) var initialResponseReceived = false - override protected def logSource: Class[_] = classOf[AllPersistenceIdsStage] + override protected def logSource: Class[?] = classOf[AllPersistenceIdsStage] override def preStart(): Unit = { journal.tell(LeveldbJournal.SubscribeAllPersistenceIds, getStageActor(journalInteraction).ref) diff --git a/persistence-query/src/main/scala/org/apache/pekko/persistence/query/journal/leveldb/EventsByPersistenceIdStage.scala b/persistence-query/src/main/scala/org/apache/pekko/persistence/query/journal/leveldb/EventsByPersistenceIdStage.scala index 2bc7f10ca60..f9ae89861bb 100644 --- a/persistence-query/src/main/scala/org/apache/pekko/persistence/query/journal/leveldb/EventsByPersistenceIdStage.scala +++ b/persistence-query/src/main/scala/org/apache/pekko/persistence/query/journal/leveldb/EventsByPersistenceIdStage.scala @@ -72,7 +72,7 @@ final private[pekko] class EventsByPersistenceIdStage( var nextSequenceNr = fromSequenceNr var toSequenceNr = initialToSequenceNr - override protected def logSource: Class[_] = classOf[EventsByPersistenceIdStage] + override protected def logSource: Class[?] = classOf[EventsByPersistenceIdStage] override def preStart(): Unit = { stageActorRef = getStageActor(journalInteraction).ref diff --git a/persistence-query/src/main/scala/org/apache/pekko/persistence/query/journal/leveldb/EventsByTagStage.scala b/persistence-query/src/main/scala/org/apache/pekko/persistence/query/journal/leveldb/EventsByTagStage.scala index 5d514ae5752..8c5b32abe06 100644 --- a/persistence-query/src/main/scala/org/apache/pekko/persistence/query/journal/leveldb/EventsByTagStage.scala +++ b/persistence-query/src/main/scala/org/apache/pekko/persistence/query/journal/leveldb/EventsByTagStage.scala @@ -72,7 +72,7 @@ final private[leveldb] class EventsByTagStage( var replayInProgress = false var outstandingReplay = false - override protected def logSource: Class[_] = classOf[EventsByTagStage] + override protected def logSource: Class[?] = classOf[EventsByTagStage] override def preStart(): Unit = { stageActorRef = getStageActor(journalInteraction).ref diff --git a/persistence-query/src/main/scala/org/apache/pekko/persistence/query/typed/EventEnvelope.scala b/persistence-query/src/main/scala/org/apache/pekko/persistence/query/typed/EventEnvelope.scala index 8403622f3ef..af6ff4b378e 100644 --- a/persistence-query/src/main/scala/org/apache/pekko/persistence/query/typed/EventEnvelope.scala +++ b/persistence-query/src/main/scala/org/apache/pekko/persistence/query/typed/EventEnvelope.scala @@ -114,7 +114,7 @@ final class EventEnvelope[Event]( } override def equals(obj: Any): Boolean = obj match { - case other: EventEnvelope[_] => + case other: EventEnvelope[?] => offset == other.offset && persistenceId == other.persistenceId && sequenceNr == other.sequenceNr && eventOption == other.eventOption && timestamp == other.timestamp && eventMetadata == other.eventMetadata && entityType == other.entityType && slice == other.slice diff --git a/persistence-shared/src/test/scala/org/apache/pekko/persistence/serialization/SerializerSpec.scala b/persistence-shared/src/test/scala/org/apache/pekko/persistence/serialization/SerializerSpec.scala index 3e245b787d3..0d9926a9f40 100644 --- a/persistence-shared/src/test/scala/org/apache/pekko/persistence/serialization/SerializerSpec.scala +++ b/persistence-shared/src/test/scala/org/apache/pekko/persistence/serialization/SerializerSpec.scala @@ -397,7 +397,7 @@ class MyPayloadSerializer extends Serializer { case x => throw new NotSerializableException(s"Unexpected object: $x") } - def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = manifest match { + def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = manifest match { case Some(MyPayloadClass) => MyPayload(s"${new String(bytes, UTF_8)}.") case Some(c) => throw new Exception(s"unexpected manifest $c") case None => throw new Exception("no manifest") @@ -441,7 +441,7 @@ class MySnapshotSerializer extends Serializer { case x => throw new NotSerializableException(s"Unexpected object: $x") } - def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = manifest match { + def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = manifest match { case Some(MySnapshotClass) => MySnapshot(s"${new String(bytes, UTF_8)}.") case Some(c) => throw new Exception(s"unexpected manifest $c") case None => throw new Exception("no manifest") diff --git a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/internal/EventSourcedBehaviorTestKitImpl.scala b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/internal/EventSourcedBehaviorTestKitImpl.scala index 93d10ff3f98..7a24766b883 100644 --- a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/internal/EventSourcedBehaviorTestKitImpl.scala +++ b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/internal/EventSourcedBehaviorTestKitImpl.scala @@ -97,7 +97,7 @@ import pekko.stream.scaladsl.Sink import EventSourcedBehaviorTestKitImpl._ - private def system: ActorSystem[_] = actorTestKit.system + private def system: ActorSystem[?] = actorTestKit.system if (system.settings.config.getBoolean("pekko.persistence.testkit.events.serialize") || system.settings.config.getBoolean("pekko.persistence.testkit.snapshots.serialize")) { system.log.warn( @@ -176,7 +176,7 @@ import pekko.stream.scaladsl.Sink } private def getHighestSeqNr(): Long = { - implicit val sys: ActorSystem[_] = system + implicit val sys: ActorSystem[?] = system val result = queries.currentEventsByPersistenceId(persistenceId.id, 0L, toSequenceNr = Long.MaxValue).runWith(Sink.lastOption) @@ -187,7 +187,7 @@ import pekko.stream.scaladsl.Sink } private def getEvents(fromSeqNr: Long): immutable.Seq[Event] = { - implicit val sys: ActorSystem[_] = system + implicit val sys: ActorSystem[?] = system val result = queries.currentEventsByPersistenceId(persistenceId.id, fromSeqNr, toSequenceNr = Long.MaxValue).runWith(Sink.seq) diff --git a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/internal/SnapshotStorageEmulatorExtension.scala b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/internal/SnapshotStorageEmulatorExtension.scala index b6ce9f65bd2..008dcd66213 100644 --- a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/internal/SnapshotStorageEmulatorExtension.scala +++ b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/internal/SnapshotStorageEmulatorExtension.scala @@ -35,6 +35,6 @@ private[testkit] object SnapshotStorageEmulatorExtension extends ExtensionId[Sna new SimpleSnapshotStorageImpl } - override def lookup: ExtensionId[_ <: Extension] = + override def lookup: ExtensionId[? <: Extension] = SnapshotStorageEmulatorExtension } diff --git a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/javadsl/EventSourcedBehaviorTestKit.scala b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/javadsl/EventSourcedBehaviorTestKit.scala index e42d3b68d7a..62d4fd61108 100644 --- a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/javadsl/EventSourcedBehaviorTestKit.scala +++ b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/javadsl/EventSourcedBehaviorTestKit.scala @@ -102,7 +102,7 @@ object EventSourcedBehaviorTestKit { * Factory method to create a new EventSourcedBehaviorTestKit. */ def create[Command, Event, State]( - system: ActorSystem[_], + system: ActorSystem[?], behavior: Behavior[Command]): EventSourcedBehaviorTestKit[Command, Event, State] = create(system, behavior, enabledSerializationSettings) @@ -112,7 +112,7 @@ object EventSourcedBehaviorTestKit { * Note that `equals` must be implemented in the commands, events and state if `verifyEquality` is enabled. */ def create[Command, Event, State]( - system: ActorSystem[_], + system: ActorSystem[?], behavior: Behavior[Command], serializationSettings: SerializationSettings): EventSourcedBehaviorTestKit[Command, Event, State] = { val scaladslSettings = new scaladsl.EventSourcedBehaviorTestKit.SerializationSettings( diff --git a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/javadsl/PersistenceTestKit.scala b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/javadsl/PersistenceTestKit.scala index aaf7fcca5f5..f9e0a35f079 100644 --- a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/javadsl/PersistenceTestKit.scala +++ b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/javadsl/PersistenceTestKit.scala @@ -451,6 +451,6 @@ object PersistenceTestKit { def create(system: ActorSystem): PersistenceTestKit = new PersistenceTestKit(system) - def create(system: TypedActorSystem[_]): PersistenceTestKit = create(system.classicSystem) + def create(system: TypedActorSystem[?]): PersistenceTestKit = create(system.classicSystem) } diff --git a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/javadsl/SnapshotTestKit.scala b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/javadsl/SnapshotTestKit.scala index 96c70dd6cbf..911b3596286 100644 --- a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/javadsl/SnapshotTestKit.scala +++ b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/javadsl/SnapshotTestKit.scala @@ -278,6 +278,6 @@ object SnapshotTestKit { def create(system: ActorSystem): SnapshotTestKit = new SnapshotTestKit(system) - def create(system: TypedActorSystem[_]): SnapshotTestKit = create(system.classicSystem) + def create(system: TypedActorSystem[?]): SnapshotTestKit = create(system.classicSystem) } diff --git a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/scaladsl/EventSourcedBehaviorTestKit.scala b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/scaladsl/EventSourcedBehaviorTestKit.scala index 4e73dff87df..274cdc0b886 100644 --- a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/scaladsl/EventSourcedBehaviorTestKit.scala +++ b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/scaladsl/EventSourcedBehaviorTestKit.scala @@ -105,7 +105,7 @@ object EventSourcedBehaviorTestKit { * Factory method to create a new EventSourcedBehaviorTestKit. */ def apply[Command, Event, State]( - system: ActorSystem[_], + system: ActorSystem[?], behavior: Behavior[Command]): EventSourcedBehaviorTestKit[Command, Event, State] = apply(system, behavior, SerializationSettings.enabled) @@ -116,7 +116,7 @@ object EventSourcedBehaviorTestKit { * `verifyEquality` is enabled. */ def apply[Command, Event, State]( - system: ActorSystem[_], + system: ActorSystem[?], behavior: Behavior[Command], serializationSettings: SerializationSettings): EventSourcedBehaviorTestKit[Command, Event, State] = new EventSourcedBehaviorTestKitImpl(ActorTestKit(system), behavior, serializationSettings) diff --git a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/scaladsl/PersistenceTestKit.scala b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/scaladsl/PersistenceTestKit.scala index 379ecd75a00..8d6a43e384a 100644 --- a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/scaladsl/PersistenceTestKit.scala +++ b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/scaladsl/PersistenceTestKit.scala @@ -410,7 +410,7 @@ object SnapshotTestKit { def apply(implicit system: ActorSystem): SnapshotTestKit = new SnapshotTestKit(system) - def apply(implicit system: TypedActorSystem[_]): SnapshotTestKit = apply(system.classicSystem) + def apply(implicit system: TypedActorSystem[?]): SnapshotTestKit = apply(system.classicSystem) object Settings extends ExtensionId[Settings] { diff --git a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/scaladsl/TestOps.scala b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/scaladsl/TestOps.scala index 960a747688c..24a61d90e63 100644 --- a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/scaladsl/TestOps.scala +++ b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/scaladsl/TestOps.scala @@ -26,7 +26,7 @@ import pekko.util import pekko.util.BoxedType private[testkit] trait RejectSupport[U] { - this: PolicyOpsTestKit[U] with HasStorage[U, _] => + this: PolicyOpsTestKit[U] with HasStorage[U, ?] => /** * Reject `n` following journal operations depending on the condition `cond`. @@ -67,7 +67,7 @@ private[testkit] trait RejectSupport[U] { } private[testkit] trait PolicyOpsTestKit[P] { - this: HasStorage[P, _] => + this: HasStorage[P, ?] => private[testkit] val Policies: DefaultPolicies[P] @@ -124,7 +124,7 @@ private[testkit] trait PolicyOpsTestKit[P] { } private[testkit] trait ExpectOps[U] { - this: HasStorage[_, U] => + this: HasStorage[?, U] => private[testkit] val probe: TestKitBase @@ -265,7 +265,7 @@ private[testkit] trait ExpectOps[U] { } private[testkit] trait ClearOps { - this: HasStorage[_, _] => + this: HasStorage[?, ?] => /** * Clear all data from the storage. @@ -294,7 +294,7 @@ private[testkit] trait ClearOps { } private[testkit] trait ClearPreservingSeqNums { - this: HasStorage[_, _] => + this: HasStorage[?, ?] => /** * Clear all data in the storage preserving sequence numbers. diff --git a/persistence-typed-tests/src/test/scala/docs/org/apache/pekko/persistence/typed/ReplicatedEventSourcingCompileOnlySpec.scala b/persistence-typed-tests/src/test/scala/docs/org/apache/pekko/persistence/typed/ReplicatedEventSourcingCompileOnlySpec.scala index 5e4215390bd..bdf8ea46acc 100644 --- a/persistence-typed-tests/src/test/scala/docs/org/apache/pekko/persistence/typed/ReplicatedEventSourcingCompileOnlySpec.scala +++ b/persistence-typed-tests/src/test/scala/docs/org/apache/pekko/persistence/typed/ReplicatedEventSourcingCompileOnlySpec.scala @@ -40,7 +40,7 @@ object ReplicatedEventSourcingCompileOnlySpec { object Shared { // #factory-shared def apply( - system: ActorSystem[_], + system: ActorSystem[?], entityId: String, replicaId: ReplicaId): EventSourcedBehavior[Command, State, Event] = { ReplicatedEventSourcing.commonJournalConfig( @@ -56,7 +56,7 @@ object ReplicatedEventSourcingCompileOnlySpec { object PerReplica { // #factory def apply( - system: ActorSystem[_], + system: ActorSystem[?], entityId: String, replicaId: ReplicaId): EventSourcedBehavior[Command, State, Event] = { ReplicatedEventSourcing.perReplicaJournalConfig( diff --git a/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorReplySpec.scala b/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorReplySpec.scala index fe5e92221a6..de0f45abddb 100644 --- a/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorReplySpec.scala +++ b/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorReplySpec.scala @@ -40,13 +40,13 @@ object EventSourcedBehaviorReplySpec { final case class State(value: Int, history: Vector[Int]) extends CborSerializable - def counter(persistenceId: PersistenceId): Behavior[Command[_]] = + def counter(persistenceId: PersistenceId): Behavior[Command[?]] = Behaviors.setup(ctx => counter(ctx, persistenceId)) def counter( - ctx: ActorContext[Command[_]], - persistenceId: PersistenceId): EventSourcedBehavior[Command[_], Event, State] = { - EventSourcedBehavior.withEnforcedReplies[Command[_], Event, State]( + ctx: ActorContext[Command[?]], + persistenceId: PersistenceId): EventSourcedBehavior[Command[?], Event, State] = { + EventSourcedBehavior.withEnforcedReplies[Command[?], Event, State]( persistenceId, emptyState = State(0, Vector.empty), commandHandler = (state, command) => diff --git a/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorSpec.scala b/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorSpec.scala index 24ede2b59da..946ce12485b 100644 --- a/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorSpec.scala +++ b/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorSpec.scala @@ -128,15 +128,15 @@ object EventSourcedBehaviorSpec { val firstLogging = "first logging" val secondLogging = "second logging" - def counter(persistenceId: PersistenceId)(implicit system: ActorSystem[_]): Behavior[Command] = + def counter(persistenceId: PersistenceId)(implicit system: ActorSystem[?]): Behavior[Command] = Behaviors.setup(ctx => counter(ctx, persistenceId)) def counter(persistenceId: PersistenceId, logging: ActorRef[String])( - implicit system: ActorSystem[_]): Behavior[Command] = + implicit system: ActorSystem[?]): Behavior[Command] = Behaviors.setup(ctx => counter(ctx, persistenceId, logging)) def counter(ctx: ActorContext[Command], persistenceId: PersistenceId)( - implicit system: ActorSystem[_]): EventSourcedBehavior[Command, Event, State] = + implicit system: ActorSystem[?]): EventSourcedBehavior[Command, Event, State] = counter( ctx, persistenceId, @@ -145,7 +145,7 @@ object EventSourcedBehaviorSpec { snapshotProbe = TestProbe[Try[SnapshotMetadata]]().ref) def counter(ctx: ActorContext[Command], persistenceId: PersistenceId, logging: ActorRef[String])( - implicit system: ActorSystem[_]): EventSourcedBehavior[Command, Event, State] = + implicit system: ActorSystem[?]): EventSourcedBehavior[Command, Event, State] = counter( ctx, persistenceId, @@ -158,18 +158,18 @@ object EventSourcedBehaviorSpec { persistenceId: PersistenceId, probe: ActorRef[(State, Event)], snapshotProbe: ActorRef[Try[SnapshotMetadata]])( - implicit system: ActorSystem[_]): EventSourcedBehavior[Command, Event, State] = + implicit system: ActorSystem[?]): EventSourcedBehavior[Command, Event, State] = counter(ctx, persistenceId, TestProbe[String]().ref, probe, snapshotProbe) def counterWithProbe(ctx: ActorContext[Command], persistenceId: PersistenceId, probe: ActorRef[(State, Event)])( - implicit system: ActorSystem[_]): EventSourcedBehavior[Command, Event, State] = + implicit system: ActorSystem[?]): EventSourcedBehavior[Command, Event, State] = counter(ctx, persistenceId, TestProbe[String]().ref, probe, TestProbe[Try[SnapshotMetadata]]().ref) def counterWithSnapshotProbe( ctx: ActorContext[Command], persistenceId: PersistenceId, probe: ActorRef[Try[SnapshotMetadata]])( - implicit system: ActorSystem[_]): EventSourcedBehavior[Command, Event, State] = + implicit system: ActorSystem[?]): EventSourcedBehavior[Command, Event, State] = counter(ctx, persistenceId, TestProbe[String]().ref, TestProbe[(State, Event)]().ref, snapshotProbe = probe) def counter( @@ -728,7 +728,7 @@ class EventSourcedBehaviorSpec firstThree ++ others should contain theSameElementsInOrderAs all } - def watcher(toWatch: ActorRef[_]): TestProbe[String] = { + def watcher(toWatch: ActorRef[?]): TestProbe[String] = { val probe = TestProbe[String]() val w = Behaviors.setup[Any] { ctx => ctx.watch(toWatch) diff --git a/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorStashSpec.scala b/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorStashSpec.scala index 16883b014d5..95343e86877 100644 --- a/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorStashSpec.scala +++ b/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorStashSpec.scala @@ -79,18 +79,18 @@ object EventSourcedBehaviorStashSpec { final case class State(value: Int, active: Boolean) - def counter(persistenceId: PersistenceId, signalProbe: Option[ActorRef[String]] = None): Behavior[Command[_]] = + def counter(persistenceId: PersistenceId, signalProbe: Option[ActorRef[String]] = None): Behavior[Command[?]] = Behaviors - .supervise[Command[_]] { + .supervise[Command[?]] { Behaviors.setup(_ => eventSourcedCounter(persistenceId, signalProbe)) } .onFailure(SupervisorStrategy.restart.withLoggingEnabled(enabled = false)) def eventSourcedCounter( persistenceId: PersistenceId, - signalProbe: Option[ActorRef[String]]): EventSourcedBehavior[Command[_], Event, State] = { + signalProbe: Option[ActorRef[String]]): EventSourcedBehavior[Command[?], Event, State] = { EventSourcedBehavior - .withEnforcedReplies[Command[_], Event, State]( + .withEnforcedReplies[Command[?], Event, State]( persistenceId, emptyState = State(0, active = true), commandHandler = (state, command) => { @@ -120,7 +120,7 @@ object EventSourcedBehaviorStashSpec { } } - private def active(state: State, command: Command[_]): ReplyEffect[Event, State] = { + private def active(state: State, command: Command[?]): ReplyEffect[Event, State] = { command match { case Increment(id, replyTo) => Effect.persist(Incremented(1)).thenReply(replyTo)(_ => Ack(id)) @@ -146,7 +146,7 @@ object EventSourcedBehaviorStashSpec { } } - private def inactive(state: State, command: Command[_]): ReplyEffect[Event, State] = { + private def inactive(state: State, command: Command[?]): ReplyEffect[Event, State] = { command match { case _: Increment => Effect.stash() diff --git a/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorWatchSpec.scala b/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorWatchSpec.scala index 17250d4e737..4b8696b0023 100644 --- a/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorWatchSpec.scala +++ b/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorWatchSpec.scala @@ -44,7 +44,7 @@ object EventSourcedBehaviorWatchSpec { case object Fail extends Command case object Stop extends Command final case class ChildHasFailed(t: pekko.actor.typed.ChildFailed) - final case class HasTerminated(ref: ActorRef[_]) + final case class HasTerminated(ref: ActorRef[?]) } class EventSourcedBehaviorWatchSpec @@ -65,7 +65,7 @@ class EventSourcedBehaviorWatchSpec private def setup( pf: PartialFunction[(String, Signal), Unit], settings: EventSourcedSettings, - context: ActorContext[_]): BehaviorSetup[Command, String, String] = + context: ActorContext[?]): BehaviorSetup[Command, String, String] = new BehaviorSetup[Command, String, String]( context.asInstanceOf[ActorContext[InternalProtocol]], nextPid, diff --git a/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/state/scaladsl/DurableStateBehaviorReplySpec.scala b/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/state/scaladsl/DurableStateBehaviorReplySpec.scala index b8c9b0cfad7..e9572d7225d 100644 --- a/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/state/scaladsl/DurableStateBehaviorReplySpec.scala +++ b/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/state/scaladsl/DurableStateBehaviorReplySpec.scala @@ -47,11 +47,11 @@ object DurableStateBehaviorReplySpec { final case class State(value: Int) extends CborSerializable - def counter(persistenceId: PersistenceId): Behavior[Command[_]] = + def counter(persistenceId: PersistenceId): Behavior[Command[?]] = Behaviors.setup(ctx => counter(ctx, persistenceId)) - def counter(ctx: ActorContext[Command[_]], persistenceId: PersistenceId): DurableStateBehavior[Command[_], State] = { - DurableStateBehavior.withEnforcedReplies[Command[_], State]( + def counter(ctx: ActorContext[Command[?]], persistenceId: PersistenceId): DurableStateBehavior[Command[?], State] = { + DurableStateBehavior.withEnforcedReplies[Command[?], State]( persistenceId, emptyState = State(0), commandHandler = (state, command) => diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/crdt/ORSet.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/crdt/ORSet.scala index 9fbf0941619..f87fb797e21 100644 --- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/crdt/ORSet.scala +++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/crdt/ORSet.scala @@ -495,7 +495,7 @@ final class ORSet[A] private[pekko] ( override def toString: String = s"OR$elements" override def equals(o: Any): Boolean = o match { - case other: ORSet[_] => + case other: ORSet[?] => originReplica == other.originReplica && vvector == other.vvector && elementsMap == other.elementsMap case _ => false } diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/delivery/EventSourcedProducerQueue.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/delivery/EventSourcedProducerQueue.scala index 8af725db33c..e1089f51da9 100644 --- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/delivery/EventSourcedProducerQueue.scala +++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/delivery/EventSourcedProducerQueue.scala @@ -52,7 +52,7 @@ object EventSourcedProducerQueue { * Scala API: Factory method from config `pekko.reliable-delivery.producer-controller.event-sourced-durable-queue` * of the `ActorSystem`. */ - def apply(system: ActorSystem[_]): Settings = + def apply(system: ActorSystem[?]): Settings = apply(system.settings.config.getConfig("pekko.reliable-delivery.producer-controller.event-sourced-durable-queue")) /** @@ -74,7 +74,7 @@ object EventSourcedProducerQueue { * Java API: Factory method from config `pekko.reliable-delivery.producer-controller.event-sourced-durable-queue` * of the `ActorSystem`. */ - def create(system: ActorSystem[_]): Settings = + def create(system: ActorSystem[?]): Settings = apply(system) /** @@ -274,7 +274,7 @@ private class EventSourcedProducerQueue[A]( case LoadState(replyTo) => Effect.reply(replyTo)(state) - case _: CleanupTick[_] => + case _: CleanupTick[?] => onCleanupTick(state) case cmd => @@ -307,7 +307,7 @@ private class EventSourcedProducerQueue[A]( def onCommandBeforeInitialCleanup(state: State[A], command: Command[A]): Effect[Event, State[A]] = { command match { - case _: CleanupTick[_] => + case _: CleanupTick[?] => val old = oldUnconfirmedToCleanup(state) val stateWithoutPartialChunkedMessages = state.cleanupPartialChunkedMessages() initialCleanupDone = true 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 40a08328b8e..53a8ca2aa4d 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 @@ -102,7 +102,7 @@ private[pekko] final case class EventSourcedBehaviorImpl[Command, Event, State]( emptyState: State, commandHandler: EventSourcedBehavior.CommandHandler[Command, Event, State], eventHandler: EventSourcedBehavior.EventHandler[State, Event], - loggerClass: Class[_], + loggerClass: Class[?], journalPluginId: Option[String] = None, snapshotPluginId: Option[String] = None, tagger: Event => Set[String] = (_: Event) => Set.empty[String], @@ -128,7 +128,7 @@ private[pekko] final case class EventSourcedBehaviorImpl[Command, Event, State]( override def apply(context: typed.TypedActorContext[Command]): Behavior[Command] = { val ctx = context.asScala val hasCustomLoggerName = ctx match { - case internalCtx: ActorContextImpl[_] => internalCtx.hasCustomLoggerName + case internalCtx: ActorContextImpl[?] => internalCtx.hasCustomLoggerName case _ => false } if (!hasCustomLoggerName) ctx.setLoggerName(loggerClass) @@ -245,7 +245,7 @@ private[pekko] final case class EventSourcedBehaviorImpl[Command, Event, State]( } @InternalStableApi - private[pekko] def initialize(@unused context: ActorContext[_]): Unit = () + private[pekko] def initialize(@unused context: ActorContext[?]): Unit = () override def receiveSignal( handler: PartialFunction[(State, Signal), Unit]): EventSourcedBehavior[Command, Event, State] = @@ -275,7 +275,7 @@ private[pekko] final case class EventSourcedBehaviorImpl[Command, Event, State]( override def withTagger(tagger: Event => Set[String]): EventSourcedBehavior[Command, Event, State] = copy(tagger = tagger) - override def eventAdapter(adapter: EventAdapter[Event, _]): EventSourcedBehavior[Command, Event, State] = + override def eventAdapter(adapter: EventAdapter[Event, ?]): EventSourcedBehavior[Command, Event, State] = copy(eventAdapter = adapter.asInstanceOf[EventAdapter[Event, Any]]) override def snapshotAdapter(adapter: SnapshotAdapter[State]): EventSourcedBehavior[Command, Event, State] = diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/EventSourcedSettings.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/EventSourcedSettings.scala index ea68d0f9280..57682931477 100644 --- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/EventSourcedSettings.scala +++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/EventSourcedSettings.scala @@ -29,7 +29,7 @@ import pekko.persistence.Persistence */ @InternalApi private[pekko] object EventSourcedSettings { - def apply(system: ActorSystem[_], journalPluginId: String, snapshotPluginId: String): EventSourcedSettings = + def apply(system: ActorSystem[?], journalPluginId: String, snapshotPluginId: String): EventSourcedSettings = apply(system.settings.config, journalPluginId, snapshotPluginId) def apply(config: Config, journalPluginId: String, snapshotPluginId: String): EventSourcedSettings = { 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 21747792d2c..f5882145cd2 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 @@ -52,7 +52,7 @@ private[pekko] trait JournalInteractions[C, E, S] { def setup: BehaviorSetup[C, E, S] protected def internalPersist( - ctx: ActorContext[_], + ctx: ActorContext[?], cmd: Any, state: Running.RunningState[S], event: EventOrTaggedOrReplicated, @@ -86,12 +86,12 @@ private[pekko] trait JournalInteractions[C, E, S] { @InternalStableApi private[pekko] def onWriteInitiated( - @unused ctx: ActorContext[_], + @unused ctx: ActorContext[?], @unused cmd: Any, @unused repr: PersistentRepr): Unit = () protected def internalPersistAll( - ctx: ActorContext[_], + ctx: ActorContext[?], cmd: Any, state: Running.RunningState[S], events: immutable.Seq[EventToPersist]): Running.RunningState[S] = { @@ -127,7 +127,7 @@ private[pekko] trait JournalInteractions[C, E, S] { @InternalStableApi private[pekko] def onWritesInitiated( - @unused ctx: ActorContext[_], + @unused ctx: ActorContext[?], @unused cmd: Any, @unused repr: immutable.Seq[PersistentRepr]): Unit = () 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 3149255a3c6..38071e6dc49 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 @@ -97,11 +97,11 @@ private[pekko] final class ReplayingEvents[C, E, S]( onRecoveryStart(setup.context) @InternalStableApi - def onRecoveryStart(@unused context: ActorContext[_]): Unit = () + def onRecoveryStart(@unused context: ActorContext[?]): Unit = () @InternalStableApi - def onRecoveryComplete(@unused context: ActorContext[_]): Unit = () + def onRecoveryComplete(@unused context: ActorContext[?]): Unit = () @InternalStableApi - def onRecoveryFailed(@unused context: ActorContext[_], @unused reason: Throwable, @unused event: Option[Any]): Unit = + def onRecoveryFailed(@unused context: ActorContext[?], @unused reason: Throwable, @unused event: Option[Any]): Unit = () override def onMessage(msg: InternalProtocol): Behavior[InternalProtocol] = { @@ -204,7 +204,7 @@ private[pekko] final class ReplayingEvents[C, E, S]( Behaviors.unhandled } } catch { - case ex: UnstashException[_] => + case ex: UnstashException[?] => // let supervisor handle it, don't treat it as recovery failure throw ex case NonFatal(cause) => 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 e28411d96d9..6897084554c 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 @@ -119,9 +119,9 @@ private[pekko] class ReplayingSnapshot[C, E, S](override val setup: BehaviorSetu } @InternalStableApi - def onRecoveryStart(@unused context: ActorContext[_]): Unit = () + def onRecoveryStart(@unused context: ActorContext[?]): Unit = () @InternalStableApi - def onRecoveryFailed(@unused context: ActorContext[_], @unused reason: Throwable): Unit = () + def onRecoveryFailed(@unused context: ActorContext[?], @unused 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 d3bf7a6076d..c7ff8775139 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 @@ -78,7 +78,7 @@ private[pekko] class RequestingRecoveryPermit[C, E, S](override val setup: Behav } @InternalStableApi - def onRequestingRecoveryPermit(@unused context: ActorContext[_]): Unit = () + def onRequestingRecoveryPermit(@unused 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 f3846b930e1..f5871789102 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 @@ -244,7 +244,7 @@ private[pekko] object Running { _currentSequenceNumber = state.seqNr - private def alreadySeen(e: ReplicatedEvent[_]): Boolean = { + private def alreadySeen(e: ReplicatedEvent[?]): Boolean = { e.originSequenceNr <= state.seenPerReplica.getOrElse(e.originReplica, 0L) } @@ -577,7 +577,7 @@ private[pekko] object Running { state: RunningState[S], effect: Effect[E, S], sideEffects: immutable.Seq[SideEffect[S]] = Nil): (Behavior[InternalProtocol], Boolean) = { - if (setup.internalLogger.isDebugEnabled && !effect.isInstanceOf[CompositeEffect[_, _]]) + if (setup.internalLogger.isDebugEnabled && !effect.isInstanceOf[CompositeEffect[?, ?]]) setup.internalLogger.debugN( s"Handled command [{}], resulting effect: [{}], side effects: [{}]", msg.getClass.getName, @@ -915,7 +915,7 @@ private[pekko] object Running { unstashAll() behavior - case callback: Callback[_] => + case callback: Callback[?] => callback.sideEffect(state.state) behavior } @@ -982,16 +982,16 @@ private[pekko] object Running { @InternalStableApi private[pekko] def onWriteFailed( - @unused ctx: ActorContext[_], + @unused ctx: ActorContext[?], @unused reason: Throwable, @unused event: PersistentRepr): Unit = () @InternalStableApi private[pekko] def onWriteRejected( - @unused ctx: ActorContext[_], + @unused ctx: ActorContext[?], @unused reason: Throwable, @unused event: PersistentRepr): Unit = () @InternalStableApi - private[pekko] def onWriteSuccess(@unused ctx: ActorContext[_], @unused event: PersistentRepr): Unit = () + private[pekko] def onWriteSuccess(@unused ctx: ActorContext[?], @unused event: PersistentRepr): Unit = () @InternalStableApi - private[pekko] def onWriteDone(@unused ctx: ActorContext[_], @unused event: PersistentRepr): Unit = () + private[pekko] def onWriteDone(@unused ctx: ActorContext[?], @unused 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 c133bcbdbdb..19255155ed9 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 @@ -181,7 +181,7 @@ abstract class EventSourcedBehavior[Command, Event, State] private[pekko] ( * Transform the event in another type before giving to the journal. Can be used to wrap events * in types Journals understand but is of a different type than `Event`. */ - def eventAdapter(): EventAdapter[Event, _] = NoOpEventAdapter.instance[Event] + def eventAdapter(): EventAdapter[Event, ?] = NoOpEventAdapter.instance[Event] /** * Transform the state into another type before giving it to and from the journal. Can be used @@ -240,7 +240,7 @@ abstract class EventSourcedBehavior[Command, Event, State] private[pekko] ( /** * The last sequence number that was persisted, can only be called from inside the handlers of an `EventSourcedBehavior` */ - final def lastSequenceNumber(ctx: ActorContext[_]): Long = { + final def lastSequenceNumber(ctx: ActorContext[?]): Long = { scaladsl.EventSourcedBehavior.lastSequenceNumber(ctx.asScala) } diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehavior.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehavior.scala index 4bdbc9225ea..efd78a06822 100644 --- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehavior.scala +++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehavior.scala @@ -52,7 +52,7 @@ object EventSourcedBehavior { */ type EventHandler[State, Event] = (State, Event) => State - private val logPrefixSkipList = classOf[EventSourcedBehavior[_, _, _]].getName :: Nil + private val logPrefixSkipList = classOf[EventSourcedBehavior[?, ?, ?]].getName :: Nil /** * Create a `Behavior` for a persistent actor. @@ -67,7 +67,7 @@ object EventSourcedBehavior { emptyState: State, commandHandler: (State, Command) => Effect[Event, State], eventHandler: (State, Event) => State): EventSourcedBehavior[Command, Event, State] = { - val loggerClass = LoggerClass.detectLoggerClassFromStack(classOf[EventSourcedBehavior[_, _, _]], logPrefixSkipList) + val loggerClass = LoggerClass.detectLoggerClassFromStack(classOf[EventSourcedBehavior[?, ?, ?]], logPrefixSkipList) EventSourcedBehaviorImpl(persistenceId, emptyState, commandHandler, eventHandler, loggerClass) } @@ -81,7 +81,7 @@ object EventSourcedBehavior { emptyState: State, commandHandler: (State, Command) => ReplyEffect[Event, State], eventHandler: (State, Event) => State): EventSourcedBehavior[Command, Event, State] = { - val loggerClass = LoggerClass.detectLoggerClassFromStack(classOf[EventSourcedBehavior[_, _, _]], logPrefixSkipList) + val loggerClass = LoggerClass.detectLoggerClassFromStack(classOf[EventSourcedBehavior[?, ?, ?]], logPrefixSkipList) EventSourcedBehaviorImpl(persistenceId, emptyState, commandHandler, eventHandler, loggerClass) } @@ -112,11 +112,11 @@ object EventSourcedBehavior { /** * The last sequence number that was persisted, can only be called from inside the handlers of an `EventSourcedBehavior` */ - def lastSequenceNumber(context: ActorContext[_]): Long = { + def lastSequenceNumber(context: ActorContext[?]): Long = { @tailrec - def extractConcreteBehavior(beh: Behavior[_]): Behavior[_] = + def extractConcreteBehavior(beh: Behavior[?]): Behavior[?] = beh match { - case interceptor: InterceptorImpl[_, _] => extractConcreteBehavior(interceptor.nestedBehavior) + case interceptor: InterceptorImpl[?, ?] => extractConcreteBehavior(interceptor.nestedBehavior) case concrete => concrete } @@ -204,7 +204,7 @@ object EventSourcedBehavior { * Transform the event to another type before giving to the journal. Can be used to wrap events * in types Journals understand but is of a different type than `Event`. */ - def eventAdapter(adapter: EventAdapter[Event, _]): EventSourcedBehavior[Command, Event, State] + def eventAdapter(adapter: EventAdapter[Event, ?]): EventSourcedBehavior[Command, Event, State] /** * Transform the state to another type before giving to the journal. Can be used to transform older diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/serialization/ReplicatedEventSourcingSerializer.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/serialization/ReplicatedEventSourcingSerializer.scala index 66fc3a55db1..07a6be65ea3 100644 --- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/serialization/ReplicatedEventSourcingSerializer.scala +++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/serialization/ReplicatedEventSourcingSerializer.scala @@ -92,11 +92,11 @@ import scala.collection.immutable.TreeMap private val PublishedEventManifest = "PA" def manifest(o: AnyRef) = o match { - case _: ORSet[_] => ORSetManifest - case _: ORSet.AddDeltaOp[_] => ORSetAddManifest - case _: ORSet.RemoveDeltaOp[_] => ORSetRemoveManifest - case _: ORSet.DeltaGroup[_] => ORSetDeltaGroupManifest - case _: ORSet.FullStateDeltaOp[_] => ORSetFullManifest + case _: ORSet[?] => ORSetManifest + case _: ORSet.AddDeltaOp[?] => ORSetAddManifest + case _: ORSet.RemoveDeltaOp[?] => ORSetRemoveManifest + case _: ORSet.DeltaGroup[?] => ORSetDeltaGroupManifest + case _: ORSet.FullStateDeltaOp[?] => ORSetFullManifest case _: Counter => CrdtCounterManifest case _: Counter.Updated => CrdtCounterUpdatedManifest @@ -117,11 +117,11 @@ import scala.collection.immutable.TreeMap case m: VersionVector => versionVectorToProto(m).toByteArray - case m: ORSet[_] => orsetToProto(m).toByteArray - case m: ORSet.AddDeltaOp[_] => orsetToProto(m.underlying).toByteArray - case m: ORSet.RemoveDeltaOp[_] => orsetToProto(m.underlying).toByteArray - case m: ORSet.DeltaGroup[_] => orsetDeltaGroupToProto(m).toByteArray - case m: ORSet.FullStateDeltaOp[_] => orsetToProto(m.underlying).toByteArray + case m: ORSet[?] => orsetToProto(m).toByteArray + case m: ORSet.AddDeltaOp[?] => orsetToProto(m.underlying).toByteArray + case m: ORSet.RemoveDeltaOp[?] => orsetToProto(m.underlying).toByteArray + case m: ORSet.DeltaGroup[?] => orsetDeltaGroupToProto(m).toByteArray + case m: ORSet.FullStateDeltaOp[?] => orsetToProto(m.underlying).toByteArray case m: Counter => counterToProtoByteArray(m) case m: Counter.Updated => counterUpdatedToProtoBufByteArray(m) @@ -212,7 +212,7 @@ import scala.collection.immutable.TreeMap .build() .toByteArray - def orsetToProto(orset: ORSet[_]): ReplicatedEventSourcing.ORSet = + def orsetToProto(orset: ORSet[?]): ReplicatedEventSourcing.ORSet = orsetToProtoImpl(orset.asInstanceOf[ORSet[Any]]) private def orsetToProtoImpl(orset: ORSet[Any]): ReplicatedEventSourcing.ORSet = { @@ -238,7 +238,7 @@ import scala.collection.immutable.TreeMap otherElementsMap = otherElementsMap.updated(enclosedMsg, other) } - def addDots(elements: ArrayList[_]): Unit = { + def addDots(elements: ArrayList[?]): Unit = { // add corresponding dots in same order val iter = elements.iterator while (iter.hasNext) { @@ -313,8 +313,8 @@ import scala.collection.immutable.TreeMap private def orsetFullFromBinary(bytes: Array[Byte]): ORSet.FullStateDeltaOp[Any] = new ORSet.FullStateDeltaOp(orsetFromProto(ReplicatedEventSourcing.ORSet.parseFrom(bytes))) - private def orsetDeltaGroupToProto(deltaGroup: ORSet.DeltaGroup[_]): ReplicatedEventSourcing.ORSetDeltaGroup = { - def createEntry(opType: ReplicatedEventSourcing.ORSetDeltaOp, u: ORSet[_]) = { + private def orsetDeltaGroupToProto(deltaGroup: ORSet.DeltaGroup[?]): ReplicatedEventSourcing.ORSetDeltaGroup = { + def createEntry(opType: ReplicatedEventSourcing.ORSetDeltaOp, u: ORSet[?]) = { ReplicatedEventSourcing.ORSetDeltaGroup.Entry.newBuilder().setOperation(opType).setUnderlying(orsetToProto(u)) } 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 93cf0627646..4ff189074d1 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 @@ -56,7 +56,7 @@ private[pekko] final case class DurableStateBehaviorImpl[Command, State]( persistenceId: PersistenceId, emptyState: State, commandHandler: DurableStateBehavior.CommandHandler[Command, State], - loggerClass: Class[_], + loggerClass: Class[?], durableStateStorePluginId: Option[String] = None, tag: String = "", snapshotAdapter: SnapshotAdapter[State] = NoOpSnapshotAdapter.instance[State], @@ -73,7 +73,7 @@ private[pekko] final case class DurableStateBehaviorImpl[Command, State]( override def apply(context: typed.TypedActorContext[Command]): Behavior[Command] = { val ctx = context.asScala val hasCustomLoggerName = ctx match { - case internalCtx: ActorContextImpl[_] => internalCtx.hasCustomLoggerName + case internalCtx: ActorContextImpl[?] => internalCtx.hasCustomLoggerName case _ => false } if (!hasCustomLoggerName) ctx.setLoggerName(loggerClass) @@ -157,7 +157,7 @@ private[pekko] final case class DurableStateBehaviorImpl[Command, State]( } @InternalStableApi - private[pekko] def initialize(@unused context: ActorContext[_]): Unit = () + private[pekko] def initialize(@unused 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/DurableStateSettings.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/DurableStateSettings.scala index aea1c4b71d1..d6a6651512f 100644 --- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/DurableStateSettings.scala +++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/DurableStateSettings.scala @@ -30,7 +30,7 @@ import pekko.persistence.Persistence */ @InternalApi private[pekko] object DurableStateSettings { - def apply(system: ActorSystem[_], durableStateStorePluginId: String): DurableStateSettings = + def apply(system: ActorSystem[?], durableStateStorePluginId: String): DurableStateSettings = apply(system.settings.config, durableStateStorePluginId) def apply(config: Config, durableStateStorePluginId: String): DurableStateSettings = { 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 a2505e5fae8..70be55588ff 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 @@ -86,9 +86,9 @@ 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(@unused ctx: ActorContext[?], @unused cmd: Any): Unit = () - private[pekko] def onDeleteInitiated(@unused ctx: ActorContext[_], @unused cmd: Any): Unit = () + private[pekko] def onDeleteInitiated(@unused ctx: ActorContext[?], @unused 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 115d7bd4ac2..752e9cfa481 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 @@ -136,11 +136,11 @@ private[pekko] class Recovering[C, S]( } @InternalStableApi - def onRecoveryStart(@unused context: ActorContext[_]): Unit = () + def onRecoveryStart(@unused context: ActorContext[?]): Unit = () @InternalStableApi - def onRecoveryComplete(@unused context: ActorContext[_]): Unit = () + def onRecoveryComplete(@unused context: ActorContext[?]): Unit = () @InternalStableApi - def onRecoveryFailed(@unused context: ActorContext[_], @unused reason: Throwable): Unit = () + def onRecoveryFailed(@unused context: ActorContext[?], @unused 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 1b24c908f2f..99888aa83ff 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 @@ -77,7 +77,7 @@ private[pekko] class RequestingRecoveryPermit[C, S](override val setup: Behavior } @InternalStableApi - def onRequestingRecoveryPermit(@unused context: ActorContext[_]): Unit = () + def onRequestingRecoveryPermit(@unused 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 d4a0a3fcba6..b3f26af7622 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 @@ -133,7 +133,7 @@ private[pekko] object Running { state: RunningState[S], effect: Effect[S], sideEffects: immutable.Seq[SideEffect[S]] = Nil): (Behavior[InternalProtocol], Boolean) = { - if (setup.internalLogger.isDebugEnabled && !effect.isInstanceOf[CompositeEffect[_]]) + if (setup.internalLogger.isDebugEnabled && !effect.isInstanceOf[CompositeEffect[?]]) setup.internalLogger.debugN( s"Handled command [{}], resulting effect: [{}], side effects: [{}]", msg.getClass.getName, @@ -151,7 +151,7 @@ private[pekko] object Running { case _: PersistNothing.type => (applySideEffects(sideEffects, state), true) - case _: Delete[_] => + case _: Delete[?] => val nextState = internalDelete(setup.context, msg, state) (applySideEffects(sideEffects, nextState), true) @@ -206,7 +206,7 @@ private[pekko] object Running { case get: GetState[S @unchecked] => stashInternal(get) case RecoveryTimeout => Behaviors.unhandled case RecoveryPermitGranted => Behaviors.unhandled - case _: GetSuccess[_] => Behaviors.unhandled + case _: GetSuccess[?] => Behaviors.unhandled case _: GetFailure => Behaviors.unhandled case DeleteSuccess => Behaviors.unhandled case DeleteFailure(_) => Behaviors.unhandled @@ -287,15 +287,15 @@ private[pekko] object Running { unstashAll() behavior - case callback: Callback[_] => + case callback: Callback[?] => callback.sideEffect(state.state) behavior } } @InternalStableApi - private[pekko] def onWriteFailed(@unused ctx: ActorContext[_], @unused reason: Throwable): Unit = () + private[pekko] def onWriteFailed(@unused ctx: ActorContext[?], @unused reason: Throwable): Unit = () @InternalStableApi - private[pekko] def onWriteSuccess(@unused ctx: ActorContext[_]): Unit = () + private[pekko] def onWriteSuccess(@unused ctx: ActorContext[?]): Unit = () } diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/javadsl/DurableStateBehavior.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/javadsl/DurableStateBehavior.scala index 7aebd4422bc..4eae81702e1 100644 --- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/javadsl/DurableStateBehavior.scala +++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/javadsl/DurableStateBehavior.scala @@ -155,7 +155,7 @@ abstract class DurableStateBehavior[Command, State] private[pekko] ( /** * The last sequence number that was persisted, can only be called from inside the handlers of a `DurableStateBehavior` */ - final def lastSequenceNumber(ctx: ActorContext[_]): Long = { + final def lastSequenceNumber(ctx: ActorContext[?]): Long = { scaladsl.DurableStateBehavior.lastSequenceNumber(ctx.asScala) } diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/scaladsl/DurableStateBehavior.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/scaladsl/DurableStateBehavior.scala index eb88f9bfd32..1080a548961 100644 --- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/scaladsl/DurableStateBehavior.scala +++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/scaladsl/DurableStateBehavior.scala @@ -44,7 +44,7 @@ object DurableStateBehavior { */ type CommandHandler[Command, State] = (State, Command) => Effect[State] - private val logPrefixSkipList = classOf[DurableStateBehavior[_, _]].getName :: Nil + private val logPrefixSkipList = classOf[DurableStateBehavior[?, ?]].getName :: Nil /** * Create a `Behavior` for a persistent actor with durable storage of its state. @@ -57,7 +57,7 @@ object DurableStateBehavior { persistenceId: PersistenceId, emptyState: State, commandHandler: (State, Command) => Effect[State]): DurableStateBehavior[Command, State] = { - val loggerClass = LoggerClass.detectLoggerClassFromStack(classOf[DurableStateBehavior[_, _]], logPrefixSkipList) + val loggerClass = LoggerClass.detectLoggerClassFromStack(classOf[DurableStateBehavior[?, ?]], logPrefixSkipList) DurableStateBehaviorImpl(persistenceId, emptyState, commandHandler, loggerClass) } @@ -70,7 +70,7 @@ object DurableStateBehavior { persistenceId: PersistenceId, emptyState: State, commandHandler: (State, Command) => ReplyEffect[State]): DurableStateBehavior[Command, State] = { - val loggerClass = LoggerClass.detectLoggerClassFromStack(classOf[DurableStateBehavior[_, _]], logPrefixSkipList) + val loggerClass = LoggerClass.detectLoggerClassFromStack(classOf[DurableStateBehavior[?, ?]], logPrefixSkipList) DurableStateBehaviorImpl(persistenceId, emptyState, commandHandler, loggerClass) } @@ -100,11 +100,11 @@ object DurableStateBehavior { /** * The last sequence number that was persisted, can only be called from inside the handlers of a `DurableStateBehavior` */ - def lastSequenceNumber(context: ActorContext[_]): Long = { + def lastSequenceNumber(context: ActorContext[?]): Long = { @tailrec - def extractConcreteBehavior(beh: Behavior[_]): Behavior[_] = + def extractConcreteBehavior(beh: Behavior[?]): Behavior[?] = beh match { - case interceptor: InterceptorImpl[_, _] => extractConcreteBehavior(interceptor.nestedBehavior) + case interceptor: InterceptorImpl[?, ?] => extractConcreteBehavior(interceptor.nestedBehavior) case concrete => concrete } diff --git a/persistence-typed/src/test/scala/docs/org/apache/pekko/persistence/typed/DurableStatePersistentBehaviorCompileOnly.scala b/persistence-typed/src/test/scala/docs/org/apache/pekko/persistence/typed/DurableStatePersistentBehaviorCompileOnly.scala index d481e1029a4..bf22675da38 100644 --- a/persistence-typed/src/test/scala/docs/org/apache/pekko/persistence/typed/DurableStatePersistentBehaviorCompileOnly.scala +++ b/persistence-typed/src/test/scala/docs/org/apache/pekko/persistence/typed/DurableStatePersistentBehaviorCompileOnly.scala @@ -51,7 +51,7 @@ object DurableStatePersistentBehaviorCompileOnly { // #command-handler import pekko.persistence.typed.state.scaladsl.Effect - val commandHandler: (State, Command[_]) => Effect[State] = (state, command) => + val commandHandler: (State, Command[?]) => Effect[State] = (state, command) => command match { case Increment => Effect.persist(state.copy(value = state.value + 1)) case IncrementBy(by) => Effect.persist(state.copy(value = state.value + by)) @@ -61,8 +61,8 @@ object DurableStatePersistentBehaviorCompileOnly { // #command-handler // #behavior - def counter(id: String): DurableStateBehavior[Command[_], State] = { - DurableStateBehavior.apply[Command[_], State]( + def counter(id: String): DurableStateBehavior[Command[?], State] = { + DurableStateBehavior.apply[Command[?], State]( persistenceId = PersistenceId.ofUniqueId(id), emptyState = State(0), commandHandler = commandHandler) @@ -76,8 +76,8 @@ object DurableStatePersistentBehaviorCompileOnly { final case class State(value: Int) extends CborSerializable - def counter(persistenceId: PersistenceId): DurableStateBehavior[Command[_], State] = { - DurableStateBehavior.apply[Command[_], State]( + def counter(persistenceId: PersistenceId): DurableStateBehavior[Command[?], State] = { + DurableStateBehavior.apply[Command[?], State]( persistenceId, emptyState = State(0), commandHandler = @@ -97,8 +97,8 @@ object DurableStatePersistentBehaviorCompileOnly { final case class State(value: Int) extends CborSerializable - def counter(persistenceId: PersistenceId): DurableStateBehavior[Command[_], State] = { - DurableStateBehavior.withEnforcedReplies[Command[_], State]( + def counter(persistenceId: PersistenceId): DurableStateBehavior[Command[?], State] = { + DurableStateBehavior.withEnforcedReplies[Command[?], State]( persistenceId, emptyState = State(0), commandHandler = (state, command) => @@ -134,9 +134,9 @@ object DurableStatePersistentBehaviorCompileOnly { } object TaggingBehavior { - def apply(): Behavior[Command[_]] = + def apply(): Behavior[Command[?]] = // #tagging - DurableStateBehavior[Command[_], State]( + DurableStateBehavior[Command[?], State]( persistenceId = PersistenceId.ofUniqueId("abc"), emptyState = State(0), commandHandler = (state, cmd) => throw new NotImplementedError("TODO: process the command & return an Effect")) @@ -148,10 +148,10 @@ object DurableStatePersistentBehaviorCompileOnly { import pekko.persistence.typed.state.scaladsl.Effect import pekko.persistence.typed.state.scaladsl.DurableStateBehavior.CommandHandler - def apply(): Behavior[Command[_]] = + def apply(): Behavior[Command[?]] = // #wrapPersistentBehavior - Behaviors.setup[Command[_]] { context => - DurableStateBehavior[Command[_], State]( + Behaviors.setup[Command[?]] { context => + DurableStateBehavior[Command[?], State]( persistenceId = PersistenceId.ofUniqueId("abc"), emptyState = State(0), commandHandler = CommandHandler.command { cmd => diff --git a/persistence-typed/src/test/scala/org/apache/pekko/persistence/typed/StashingWhenSnapshottingSpec.scala b/persistence-typed/src/test/scala/org/apache/pekko/persistence/typed/StashingWhenSnapshottingSpec.scala index 165213a1595..a630254980e 100644 --- a/persistence-typed/src/test/scala/org/apache/pekko/persistence/typed/StashingWhenSnapshottingSpec.scala +++ b/persistence-typed/src/test/scala/org/apache/pekko/persistence/typed/StashingWhenSnapshottingSpec.scala @@ -40,7 +40,7 @@ import pekko.persistence.typed.scaladsl.EventSourcedBehavior object StashingWhenSnapshottingSpec { object ControllableSnapshotStoreExt extends ExtensionId[ControllableSnapshotStoreExt] { - override def createExtension(system: ActorSystem[_]): ControllableSnapshotStoreExt = + override def createExtension(system: ActorSystem[?]): ControllableSnapshotStoreExt = new ControllableSnapshotStoreExt() } diff --git a/persistence-typed/src/test/scala/org/apache/pekko/persistence/typed/internal/StashStateSpec.scala b/persistence-typed/src/test/scala/org/apache/pekko/persistence/typed/internal/StashStateSpec.scala index 7e13db514ea..ba8f2dec663 100644 --- a/persistence-typed/src/test/scala/org/apache/pekko/persistence/typed/internal/StashStateSpec.scala +++ b/persistence-typed/src/test/scala/org/apache/pekko/persistence/typed/internal/StashStateSpec.scala @@ -58,7 +58,7 @@ class StashStateSpec extends ScalaTestWithActorTestKit with AnyWordSpecLike with stashState.internalStashBuffer.stash(RecoveryPermitGranted) probe.ref ! stashState.internalStashBuffer.size Behaviors.same[InternalProtocol] - case _: IncomingCommand[_] => Behaviors.stopped + case _: IncomingCommand[?] => Behaviors.stopped } .receiveSignal { case (_, _) => diff --git a/persistence-typed/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/PersistentActorCompileOnlyTest.scala b/persistence-typed/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/PersistentActorCompileOnlyTest.scala index c82341ddfd3..ea1b9a26b0f 100644 --- a/persistence-typed/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/PersistentActorCompileOnlyTest.scala +++ b/persistence-typed/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/PersistentActorCompileOnlyTest.scala @@ -76,7 +76,7 @@ object PersistentActorCompileOnlyTest { def performSideEffect(sender: ActorRef[AcknowledgeSideEffect], correlationId: Int, data: String): Unit = { import pekko.actor.typed.scaladsl.AskPattern._ implicit val timeout: pekko.util.Timeout = 1.second - implicit val system: ActorSystem[_] = ??? + implicit val system: ActorSystem[?] = ??? implicit val ec: ExecutionContext = ??? val response: Future[RecoveryComplete.Response] = diff --git a/persistence/src/main/scala-2/org/apache/pekko/persistence/TraitOrder.scala b/persistence/src/main/scala-2/org/apache/pekko/persistence/TraitOrder.scala index 75ccd19c30e..aa0854ad208 100644 --- a/persistence/src/main/scala-2/org/apache/pekko/persistence/TraitOrder.scala +++ b/persistence/src/main/scala-2/org/apache/pekko/persistence/TraitOrder.scala @@ -22,7 +22,7 @@ import org.apache.pekko.annotation.InternalApi private[persistence] object TraitOrder { val canBeChecked = true - def checkBefore(clazz: Class[_], one: Class[_], other: Class[_]): Unit = { + def checkBefore(clazz: Class[?], one: Class[?], other: Class[?]): Unit = { val interfaces = clazz.getInterfaces val i = interfaces.indexOf(other) val j = interfaces.indexOf(one) diff --git a/persistence/src/main/scala/org/apache/pekko/persistence/PersistencePlugin.scala b/persistence/src/main/scala/org/apache/pekko/persistence/PersistencePlugin.scala index 4f2dcb1e8f7..8bfae3e0d6e 100644 --- a/persistence/src/main/scala/org/apache/pekko/persistence/PersistencePlugin.scala +++ b/persistence/src/main/scala/org/apache/pekko/persistence/PersistencePlugin.scala @@ -55,7 +55,7 @@ private[pekko] abstract class PersistencePlugin[ScalaDsl, JavaDsl, T: ClassTag]( implicit ev: PluginProvider[T, ScalaDsl, JavaDsl]) { private val plugins = new AtomicReference[Map[String, ExtensionId[PluginHolder[ScalaDsl, JavaDsl]]]](Map.empty) - private val log = Logging(system, classOf[PersistencePlugin[_, _, _]]) + private val log = Logging(system, classOf[PersistencePlugin[?, ?, ?]]) @tailrec final protected def pluginFor(pluginId: String, readJournalPluginConfig: Config): PluginHolder[ScalaDsl, JavaDsl] = { @@ -86,7 +86,7 @@ private[pekko] abstract class PersistencePlugin[ScalaDsl, JavaDsl, T: ClassTag]( log.debug(s"Create plugin: $configPath $pluginClassName") val pluginClass = system.dynamicAccess.getClassFor[AnyRef](pluginClassName).get - def instantiate(args: collection.immutable.Seq[(Class[_], AnyRef)]) = + def instantiate(args: collection.immutable.Seq[(Class[?], AnyRef)]) = system.dynamicAccess.createInstanceFor[T](pluginClass, args) instantiate( diff --git a/persistence/src/main/scala/org/apache/pekko/persistence/journal/EventAdapters.scala b/persistence/src/main/scala/org/apache/pekko/persistence/journal/EventAdapters.scala index abf98ca69d0..5b658853583 100644 --- a/persistence/src/main/scala/org/apache/pekko/persistence/journal/EventAdapters.scala +++ b/persistence/src/main/scala/org/apache/pekko/persistence/journal/EventAdapters.scala @@ -33,8 +33,8 @@ import pekko.util.ccompat._ */ @ccompatUsedUntil213 class EventAdapters( - map: ConcurrentHashMap[Class[_], EventAdapter], - bindings: immutable.Seq[(Class[_], EventAdapter)], + map: ConcurrentHashMap[Class[?], EventAdapter], + bindings: immutable.Seq[(Class[?], EventAdapter)], log: LoggingAdapter) { /** @@ -43,7 +43,7 @@ class EventAdapters( * * Falls back to [[IdentityEventAdapter]] if no adapter was defined for the given class. */ - def get(clazz: Class[_]): EventAdapter = { + def get(clazz: Class[?]): EventAdapter = { map.get(clazz) match { case null => // bindings are ordered from most specific to least specific val value = bindings.filter { @@ -72,7 +72,7 @@ private[pekko] object EventAdapters { type Name = String type BoundAdapters = immutable.Seq[String] type FQN = String - type ClassHandler = (Class[_], EventAdapter) + type ClassHandler = (Class[?], EventAdapter) def apply(system: ExtendedActorSystem, config: Config): EventAdapters = { val adapters = configToMap(config, "event-adapters") @@ -116,7 +116,7 @@ private[pekko] object EventAdapters { sort(bs) } - val backing = bindings.foldLeft(new ConcurrentHashMap[Class[_], EventAdapter]) { + val backing = bindings.foldLeft(new ConcurrentHashMap[Class[?], EventAdapter]) { case (map, (c, s)) => map.put(c, s); map } @@ -162,8 +162,8 @@ private[pekko] object EventAdapters { * Sort so that subtypes always precede their supertypes, but without * obeying any order between unrelated subtypes (insert sort). */ - private def sort[T](in: Iterable[(Class[_], T)]): immutable.Seq[(Class[_], T)] = - in.foldLeft(new ArrayBuffer[(Class[_], T)](in.size)) { (buf, ca) => + private def sort[T](in: Iterable[(Class[?], T)]): immutable.Seq[(Class[?], T)] = + in.foldLeft(new ArrayBuffer[(Class[?], T)](in.size)) { (buf, ca) => buf.indexWhere(_._1.isAssignableFrom(ca._1)) match { case -1 => buf.append(ca) case x => buf.insert(x, ca) @@ -183,7 +183,7 @@ private[pekko] object EventAdapters { import pekko.util.ccompat.JavaConverters._ if (config.hasPath(path)) { config.getConfig(path).root.unwrapped.asScala.toMap.map { - case (k, v: util.ArrayList[_]) if v.isInstanceOf[util.ArrayList[_]] => k -> v.asScala.map(_.toString).toList + case (k, v: util.ArrayList[?]) if v.isInstanceOf[util.ArrayList[?]] => k -> v.asScala.map(_.toString).toList case (k, v) => k -> List(v.toString) } } else Map.empty @@ -192,6 +192,6 @@ private[pekko] object EventAdapters { } private[pekko] case object IdentityEventAdapters extends EventAdapters(null, null, null) { - override def get(clazz: Class[_]): EventAdapter = IdentityEventAdapter + override def get(clazz: Class[?]): EventAdapter = IdentityEventAdapter override def toString = Logging.simpleName(IdentityEventAdapters) } diff --git a/persistence/src/main/scala/org/apache/pekko/persistence/journal/PersistencePluginProxy.scala b/persistence/src/main/scala/org/apache/pekko/persistence/journal/PersistencePluginProxy.scala index f6e0bce843e..a7e9f215691 100644 --- a/persistence/src/main/scala/org/apache/pekko/persistence/journal/PersistencePluginProxy.scala +++ b/persistence/src/main/scala/org/apache/pekko/persistence/journal/PersistencePluginProxy.scala @@ -77,7 +77,7 @@ object PersistencePluginProxyExtension with ExtensionIdProvider { override def createExtension(system: ExtendedActorSystem): PersistencePluginProxyExtensionImpl = new PersistencePluginProxyExtensionImpl(system) - override def lookup: ExtensionId[_ <: Extension] = PersistencePluginProxyExtension + override def lookup: ExtensionId[? <: Extension] = PersistencePluginProxyExtension override def get(system: ActorSystem): PersistencePluginProxyExtensionImpl = super.get(system) override def get(system: ClassicActorSystemProvider): PersistencePluginProxyExtensionImpl = super.get(system) } diff --git a/persistence/src/main/scala/org/apache/pekko/persistence/serialization/MessageSerializer.scala b/persistence/src/main/scala/org/apache/pekko/persistence/serialization/MessageSerializer.scala index 8e43421beab..3f91c8589c2 100644 --- a/persistence/src/main/scala/org/apache/pekko/persistence/serialization/MessageSerializer.scala +++ b/persistence/src/main/scala/org/apache/pekko/persistence/serialization/MessageSerializer.scala @@ -71,7 +71,7 @@ class MessageSerializer(val system: ExtendedActorSystem) extends BaseSerializer * Deserializes persistent messages. Delegates deserialization of a persistent * message's payload to a matching `org.apache.pekko.serialization.Serializer`. */ - def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): Message = manifest match { + def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): Message = manifest match { case None => persistent(mf.PersistentMessage.parseFrom(bytes)) case Some(c) => c match { diff --git a/persistence/src/main/scala/org/apache/pekko/persistence/serialization/SnapshotSerializer.scala b/persistence/src/main/scala/org/apache/pekko/persistence/serialization/SnapshotSerializer.scala index d9926f2a35a..b07297997c3 100644 --- a/persistence/src/main/scala/org/apache/pekko/persistence/serialization/SnapshotSerializer.scala +++ b/persistence/src/main/scala/org/apache/pekko/persistence/serialization/SnapshotSerializer.scala @@ -51,7 +51,7 @@ class SnapshotSerializer(val system: ExtendedActorSystem) extends BaseSerializer * Deserializes a [[Snapshot]]. Delegates deserialization of snapshot `data` to a matching * `org.apache.pekko.serialization.Serializer`. */ - def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = + def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = Snapshot(snapshotFromBinary(bytes)) private def headerToBinary(snapshot: AnyRef, snapshotSerializer: Serializer): Array[Byte] = { 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 ac1a7ec4978..14965cf4952 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 @@ -45,16 +45,16 @@ object DurableStateStoreRegistry extends ExtensionId[DurableStateStoreRegistry] @InternalApi private[pekko] val pluginProvider - : PluginProvider[DurableStateStoreProvider, DurableStateStore[_], javadsl.DurableStateStore[_]] = - new PluginProvider[DurableStateStoreProvider, scaladsl.DurableStateStore[_], javadsl.DurableStateStore[_]] { - override def scalaDsl(t: DurableStateStoreProvider): DurableStateStore[_] = t.scaladslDurableStateStore() - override def javaDsl(t: DurableStateStoreProvider): javadsl.DurableStateStore[_] = t.javadslDurableStateStore() + : PluginProvider[DurableStateStoreProvider, DurableStateStore[?], javadsl.DurableStateStore[?]] = + new PluginProvider[DurableStateStoreProvider, scaladsl.DurableStateStore[?], javadsl.DurableStateStore[?]] { + override def scalaDsl(t: DurableStateStoreProvider): DurableStateStore[?] = t.scaladslDurableStateStore() + override def javaDsl(t: DurableStateStoreProvider): javadsl.DurableStateStore[?] = t.javadslDurableStateStore() } } class DurableStateStoreRegistry(system: ExtendedActorSystem) - extends PersistencePlugin[scaladsl.DurableStateStore[_], javadsl.DurableStateStore[_], DurableStateStoreProvider]( + extends PersistencePlugin[scaladsl.DurableStateStore[?], javadsl.DurableStateStore[?], DurableStateStoreProvider]( system)(ClassTag(classOf[DurableStateStoreProvider]), DurableStateStoreRegistry.pluginProvider) with Extension { @@ -87,7 +87,7 @@ class DurableStateStoreRegistry(system: ExtendedActorSystem) * Scala API: Returns the [[pekko.persistence.state.scaladsl.DurableStateStore]] specified by the given * configuration entry. */ - final def durableStateStoreFor[T <: scaladsl.DurableStateStore[_]](pluginId: String): T = { + final def durableStateStoreFor[T <: scaladsl.DurableStateStore[?]](pluginId: String): T = { pluginFor(pluginIdOrDefault(pluginId), pluginConfig(pluginId)).scaladslPlugin.asInstanceOf[T] } @@ -95,7 +95,7 @@ class DurableStateStoreRegistry(system: ExtendedActorSystem) * Java API: Returns the [[pekko.persistence.state.javadsl.DurableStateStore]] specified by the given * configuration entry. */ - final def getDurableStateStoreFor[T <: javadsl.DurableStateStore[_]]( + final def getDurableStateStoreFor[T <: javadsl.DurableStateStore[?]]( @unused 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/AtLeastOnceDeliverySpec.scala b/persistence/src/test/scala/org/apache/pekko/persistence/AtLeastOnceDeliverySpec.scala index ad2f108c813..44ff3f4792f 100644 --- a/persistence/src/test/scala/org/apache/pekko/persistence/AtLeastOnceDeliverySpec.scala +++ b/persistence/src/test/scala/org/apache/pekko/persistence/AtLeastOnceDeliverySpec.scala @@ -256,7 +256,7 @@ class AtLeastOnceDeliverySpec "not allow using actorSelection with wildcards" in { system.actorOf(Props(classOf[DeliverToStarSelection], name)) ! "anything, really." - expectMsgType[Failure[_]].toString should include("not supported") + expectMsgType[Failure[?]].toString should include("not supported") } "re-deliver lost messages after restart" taggedAs TimingTest in { diff --git a/persistence/src/test/scala/org/apache/pekko/persistence/PersistentActorSpec.scala b/persistence/src/test/scala/org/apache/pekko/persistence/PersistentActorSpec.scala index 9a473dcf085..1cf0fe47f0d 100644 --- a/persistence/src/test/scala/org/apache/pekko/persistence/PersistentActorSpec.scala +++ b/persistence/src/test/scala/org/apache/pekko/persistence/PersistentActorSpec.scala @@ -215,7 +215,7 @@ object PersistentActorSpec { class SnapshottingPersistentActor(name: String, probe: ActorRef) extends ExamplePersistentActor(name) { override def receiveRecover = super.receiveRecover.orElse { - case SnapshotOffer(_, events: List[_]) => + case SnapshotOffer(_, events: List[?]) => probe ! "offered" this.events = events } diff --git a/persistence/src/test/scala/org/apache/pekko/persistence/SnapshotRecoveryWithEmptyJournalSpec.scala b/persistence/src/test/scala/org/apache/pekko/persistence/SnapshotRecoveryWithEmptyJournalSpec.scala index c9c41ebec38..e4415735d39 100644 --- a/persistence/src/test/scala/org/apache/pekko/persistence/SnapshotRecoveryWithEmptyJournalSpec.scala +++ b/persistence/src/test/scala/org/apache/pekko/persistence/SnapshotRecoveryWithEmptyJournalSpec.scala @@ -33,7 +33,7 @@ object SnapshotRecoveryWithEmptyJournalSpec { override def receiveRecover: Receive = { case payload: String => state = s"$payload-$lastSequenceNr" :: state - case SnapshotOffer(_, snapshot: List[_]) => state = snapshot.asInstanceOf[List[String]] + case SnapshotOffer(_, snapshot: List[?]) => state = snapshot.asInstanceOf[List[String]] } override def receiveCommand: PartialFunction[Any, Unit] = { diff --git a/persistence/src/test/scala/org/apache/pekko/persistence/SnapshotSerializationSpec.scala b/persistence/src/test/scala/org/apache/pekko/persistence/SnapshotSerializationSpec.scala index 0a401cbb926..4ce46493e4d 100644 --- a/persistence/src/test/scala/org/apache/pekko/persistence/SnapshotSerializationSpec.scala +++ b/persistence/src/test/scala/org/apache/pekko/persistence/SnapshotSerializationSpec.scala @@ -51,7 +51,7 @@ object SnapshotSerializationSpec { bStream.toByteArray } - def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = { + def fromBinary(bytes: Array[Byte], clazz: Option[Class[?]]): AnyRef = { val bStream = new ByteArrayInputStream(bytes) val reader = new BufferedReader(new InputStreamReader(bStream)) new MySnapshot(reader.readLine()) diff --git a/persistence/src/test/scala/org/apache/pekko/persistence/SnapshotSpec.scala b/persistence/src/test/scala/org/apache/pekko/persistence/SnapshotSpec.scala index a9bfefaf5e1..21eacbf6709 100644 --- a/persistence/src/test/scala/org/apache/pekko/persistence/SnapshotSpec.scala +++ b/persistence/src/test/scala/org/apache/pekko/persistence/SnapshotSpec.scala @@ -25,7 +25,7 @@ object SnapshotSpec { override def receiveRecover: Receive = { case payload: String => state = s"$payload-$lastSequenceNr" :: state - case SnapshotOffer(_, snapshot: List[_]) => state = snapshot.asInstanceOf[List[String]] + case SnapshotOffer(_, snapshot: List[?]) => state = snapshot.asInstanceOf[List[String]] } override def receiveCommand = { diff --git a/persistence/src/test/scala/org/apache/pekko/persistence/serialization/SnapshotSerializerSpec.scala b/persistence/src/test/scala/org/apache/pekko/persistence/serialization/SnapshotSerializerSpec.scala index bcadc2e8bd3..11d3816253a 100644 --- a/persistence/src/test/scala/org/apache/pekko/persistence/serialization/SnapshotSerializerSpec.scala +++ b/persistence/src/test/scala/org/apache/pekko/persistence/serialization/SnapshotSerializerSpec.scala @@ -37,8 +37,8 @@ class SnapshotSerializerSpec extends PekkoSpec { val bytes = Base64.getDecoder.decode(data) val result = serialization.deserialize(bytes, classOf[Snapshot]).get val deserialized = result.data - deserialized shouldBe a[PersistentFSMSnapshot[_]] - val persistentFSMSnapshot = deserialized.asInstanceOf[PersistentFSMSnapshot[_]] + deserialized shouldBe a[PersistentFSMSnapshot[?]] + val persistentFSMSnapshot = deserialized.asInstanceOf[PersistentFSMSnapshot[?]] persistentFSMSnapshot shouldEqual PersistentFSMSnapshot[String]("test-identifier", "test-data", None) } } diff --git a/remote/src/main/scala/org/apache/pekko/remote/Endpoint.scala b/remote/src/main/scala/org/apache/pekko/remote/Endpoint.scala index ffcbef77cac..114ee8dc6e0 100644 --- a/remote/src/main/scala/org/apache/pekko/remote/Endpoint.scala +++ b/remote/src/main/scala/org/apache/pekko/remote/Endpoint.scala @@ -82,7 +82,7 @@ private[remote] class DefaultMessageDispatcher( import provider.remoteSettings._ lazy val payload: AnyRef = MessageSerializer.deserialize(system, serializedMessage) - def payloadClass: Class[_] = if (payload eq null) null else payload.getClass + def payloadClass: Class[?] = if (payload eq null) null else payload.getClass val sender: ActorRef = senderOption.getOrElse(system.deadLetters) val originalReceiver = recipient.path diff --git a/remote/src/main/scala/org/apache/pekko/remote/RemoteDaemon.scala b/remote/src/main/scala/org/apache/pekko/remote/RemoteDaemon.scala index 524c6878928..c9d63c3d2b1 100644 --- a/remote/src/main/scala/org/apache/pekko/remote/RemoteDaemon.scala +++ b/remote/src/main/scala/org/apache/pekko/remote/RemoteDaemon.scala @@ -285,7 +285,7 @@ private[pekko] class RemoteSystemDaemon( } /** INTERNAL API */ -final class NotAllowedClassRemoteDeploymentAttemptException(illegal: Class[_], allowedClassNames: immutable.Set[String]) +final class NotAllowedClassRemoteDeploymentAttemptException(illegal: Class[?], allowedClassNames: immutable.Set[String]) extends RuntimeException( s"Attempted to deploy Actor class: " + s"[$illegal], " + diff --git a/remote/src/main/scala/org/apache/pekko/remote/RemoteMetricsExtension.scala b/remote/src/main/scala/org/apache/pekko/remote/RemoteMetricsExtension.scala index 63f2545193d..90c4d3d7ecd 100644 --- a/remote/src/main/scala/org/apache/pekko/remote/RemoteMetricsExtension.scala +++ b/remote/src/main/scala/org/apache/pekko/remote/RemoteMetricsExtension.scala @@ -78,7 +78,7 @@ private[pekko] class RemoteMetricsOn(system: ExtendedActorSystem) extends Remote private val logFrameSizeExceeding: Int = RARP(system).provider.remoteSettings.LogFrameSizeExceeding.getOrElse(Int.MaxValue) private val log = Logging(system, classOf[RemoteMetrics]) - private val maxPayloadBytes: ConcurrentHashMap[Class[_], Integer] = new ConcurrentHashMap + private val maxPayloadBytes: ConcurrentHashMap[Class[?], Integer] = new ConcurrentHashMap override def logPayloadBytes(msg: Any, payloadBytes: Int): Unit = if (payloadBytes >= logFrameSizeExceeding) { 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 9efb6196f8f..d1806f61814 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 @@ -93,7 +93,7 @@ private[remote] class OutboundHandshake( private val uniqueRemoteAddressListener: UniqueAddress => Unit = peer => uniqueRemoteAddressAsyncCallback.invoke(peer) - override protected def logSource: Class[_] = classOf[OutboundHandshake] + override protected def logSource: Class[?] = classOf[OutboundHandshake] override def preStart(): Unit = { scheduleOnce(HandshakeTimeout, timeout) diff --git a/remote/src/main/scala/org/apache/pekko/remote/artery/ImmutableLongMap.scala b/remote/src/main/scala/org/apache/pekko/remote/artery/ImmutableLongMap.scala index ddc703fd178..2b3d7f70aca 100644 --- a/remote/src/main/scala/org/apache/pekko/remote/artery/ImmutableLongMap.scala +++ b/remote/src/main/scala/org/apache/pekko/remote/artery/ImmutableLongMap.scala @@ -128,7 +128,7 @@ private[pekko] class ImmutableLongMap[A >: Null] private (private val keys: Arra } override def equals(obj: Any): Boolean = obj match { - case other: ImmutableLongMap[_] => + case other: ImmutableLongMap[?] => if (other eq this) true else if (size != other.size) false else if (size == 0 && other.size == 0) true 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 7123483fd65..4be5452398b 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 @@ -111,7 +111,7 @@ abstract class RemoteInstrument { private val log = Logging(system, classOf[LoggingRemoteInstrument]) - private val maxPayloadBytes: ConcurrentHashMap[Class[_], Integer] = new ConcurrentHashMap + private val maxPayloadBytes: ConcurrentHashMap[Class[?], Integer] = new ConcurrentHashMap override def identifier: Byte = 1 // Cinnamon is using 0 diff --git a/remote/src/main/scala/org/apache/pekko/remote/artery/RemotingFlightRecorder.scala b/remote/src/main/scala/org/apache/pekko/remote/artery/RemotingFlightRecorder.scala index 928884277a6..6df3464272f 100644 --- a/remote/src/main/scala/org/apache/pekko/remote/artery/RemotingFlightRecorder.scala +++ b/remote/src/main/scala/org/apache/pekko/remote/artery/RemotingFlightRecorder.scala @@ -37,7 +37,7 @@ object RemotingFlightRecorder extends ExtensionId[RemotingFlightRecorder] with E "org.apache.pekko.remote.artery.jfr.JFRRemotingFlightRecorder", NoOpRemotingFlightRecorder) - override def lookup: ExtensionId[_ <: Extension] = this + override def lookup: ExtensionId[? <: Extension] = this } /** diff --git a/remote/src/main/scala/org/apache/pekko/remote/artery/SystemMessageDelivery.scala b/remote/src/main/scala/org/apache/pekko/remote/artery/SystemMessageDelivery.scala index 2bcbc21afac..f68158d84a2 100644 --- a/remote/src/main/scala/org/apache/pekko/remote/artery/SystemMessageDelivery.scala +++ b/remote/src/main/scala/org/apache/pekko/remote/artery/SystemMessageDelivery.scala @@ -111,7 +111,7 @@ import pekko.util.PrettyDuration.PrettyPrintableDuration private def remoteAddressLogParam: String = outboundContext.associationState.uniqueRemoteAddress().getOrElse(remoteAddress).toString - override protected def logSource: Class[_] = classOf[SystemMessageDelivery] + override protected def logSource: Class[?] = classOf[SystemMessageDelivery] override def preStart(): Unit = { val callback = getAsyncCallback[Done] { _ => @@ -351,7 +351,7 @@ import pekko.util.PrettyDuration.PrettyPrintableDuration def localAddress = inboundContext.localAddress - override protected def logSource: Class[_] = classOf[SystemMessageAcker] + override protected def logSource: Class[?] = classOf[SystemMessageAcker] // InHandler override def onPush(): Unit = { diff --git a/remote/src/main/scala/org/apache/pekko/remote/artery/compress/CompressionTable.scala b/remote/src/main/scala/org/apache/pekko/remote/artery/compress/CompressionTable.scala index d91975ed9d6..6086901e086 100644 --- a/remote/src/main/scala/org/apache/pekko/remote/artery/compress/CompressionTable.scala +++ b/remote/src/main/scala/org/apache/pekko/remote/artery/compress/CompressionTable.scala @@ -90,7 +90,7 @@ private[remote] final class CompressionTable[T]( } override def equals(obj: Any): Boolean = obj match { - case other: CompressionTable[_] => + case other: CompressionTable[?] => originUid == other.originUid && version == other.version && _dictionary == other._dictionary case _ => false } diff --git a/remote/src/main/scala/org/apache/pekko/remote/artery/tcp/ssl/X509Readers.scala b/remote/src/main/scala/org/apache/pekko/remote/artery/tcp/ssl/X509Readers.scala index 9a38fecddfb..98d081a7e6f 100644 --- a/remote/src/main/scala/org/apache/pekko/remote/artery/tcp/ssl/X509Readers.scala +++ b/remote/src/main/scala/org/apache/pekko/remote/artery/tcp/ssl/X509Readers.scala @@ -34,7 +34,7 @@ private[pekko] object X509Readers { attr.getValue.toString } - val iterable: Iterable[util.List[_]] = Option(cert.getSubjectAlternativeNames).map(_.asScala).getOrElse(Nil) + val iterable: Iterable[util.List[?]] = Option(cert.getSubjectAlternativeNames).map(_.asScala).getOrElse(Nil) val alternates = iterable.collect { // See the javadocs of cert.getSubjectAlternativeNames for what this list contains, // first element should be an integer, if that integer is 2, then the second element diff --git a/remote/src/main/scala/org/apache/pekko/remote/serialization/DaemonMsgCreateSerializer.scala b/remote/src/main/scala/org/apache/pekko/remote/serialization/DaemonMsgCreateSerializer.scala index 78b0e341711..92a5744aaac 100644 --- a/remote/src/main/scala/org/apache/pekko/remote/serialization/DaemonMsgCreateSerializer.scala +++ b/remote/src/main/scala/org/apache/pekko/remote/serialization/DaemonMsgCreateSerializer.scala @@ -106,7 +106,7 @@ private[pekko] final class DaemonMsgCreateSerializer(val system: ExtendedActorSy "Can't serialize a non-DaemonMsgCreate message using DaemonMsgCreateSerializer [%s]".format(obj)) } - def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = { + def fromBinary(bytes: Array[Byte], clazz: Option[Class[?]]): AnyRef = { val proto = DaemonMsgCreateData.parseFrom(bytes) def deploy(protoDeploy: DeployData): Deploy = { diff --git a/remote/src/main/scala/org/apache/pekko/remote/serialization/MessageContainerSerializer.scala b/remote/src/main/scala/org/apache/pekko/remote/serialization/MessageContainerSerializer.scala index 602a187de8e..b6612edaa2b 100644 --- a/remote/src/main/scala/org/apache/pekko/remote/serialization/MessageContainerSerializer.scala +++ b/remote/src/main/scala/org/apache/pekko/remote/serialization/MessageContainerSerializer.scala @@ -73,7 +73,7 @@ class MessageContainerSerializer(val system: ExtendedActorSystem) extends BaseSe builder } - def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = { + def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = { val selectionEnvelope = ContainerFormats.SelectionEnvelope.parseFrom(bytes) val manifest = if (selectionEnvelope.hasMessageManifest) selectionEnvelope.getMessageManifest.toStringUtf8 else "" val msg = serialization diff --git a/remote/src/main/scala/org/apache/pekko/remote/serialization/MiscMessageSerializer.scala b/remote/src/main/scala/org/apache/pekko/remote/serialization/MiscMessageSerializer.scala index 897f6e05ba9..69e99bd798d 100644 --- a/remote/src/main/scala/org/apache/pekko/remote/serialization/MiscMessageSerializer.scala +++ b/remote/src/main/scala/org/apache/pekko/remote/serialization/MiscMessageSerializer.scala @@ -47,7 +47,7 @@ class MiscMessageSerializer(val system: ExtendedActorSystem) extends SerializerW case identity: ActorIdentity => serializeActorIdentity(identity) case Some(value) => serializeSome(value) case None => ParameterlessSerializedMessage - case o: Optional[_] => serializeOptional(o) + case o: Optional[?] => serializeOptional(o) case r: ActorRef => serializeActorRef(r) case s: Status.Success => serializeStatusSuccess(s) case f: Status.Failure => serializeStatusFailure(f) @@ -103,7 +103,7 @@ class MiscMessageSerializer(val system: ExtendedActorSystem) extends SerializerW private def serializeSome(someValue: Any): Array[Byte] = ContainerFormats.Option.newBuilder().setValue(payloadSupport.payloadBuilder(someValue)).build().toByteArray - private def serializeOptional(opt: Optional[_]): Array[Byte] = { + private def serializeOptional(opt: Optional[?]): Array[Byte] = { if (opt.isPresent) ContainerFormats.Option.newBuilder().setValue(payloadSupport.payloadBuilder(opt.get)).build().toByteArray else @@ -136,7 +136,7 @@ class MiscMessageSerializer(val system: ExtendedActorSystem) extends SerializerW // no specific message, serialized id and manifest together with payload is enough (no wrapping overhead) payloadSupport.payloadBuilder(r.getValue).build().toByteArray - def serializeStatusReplyError(r: StatusReply[_]): Array[Byte] = { + def serializeStatusReplyError(r: StatusReply[?]): Array[Byte] = { r.getError match { case em: StatusReply.ErrorMessage => // somewhat optimized for the recommended usage, avoiding the additional payload metadata @@ -386,7 +386,7 @@ class MiscMessageSerializer(val system: ExtendedActorSystem) extends SerializerW case _: Identify => IdentifyManifest case _: ActorIdentity => ActorIdentityManifest case _: Option[Any] => OptionManifest - case _: Optional[_] => OptionalManifest + case _: Optional[?] => OptionalManifest case _: ActorRef => ActorRefManifest case _: Status.Success => StatusSuccessManifest case _: Status.Failure => StatusFailureManifest @@ -477,13 +477,13 @@ class MiscMessageSerializer(val system: ExtendedActorSystem) extends SerializerW private def deserializeStatusFailure(bytes: Array[Byte]): Status.Failure = Status.Failure(payloadSupport.deserializePayload(ContainerFormats.Payload.parseFrom(bytes)).asInstanceOf[Throwable]) - private def deserializeStatusReplySuccess(bytes: Array[Byte]): StatusReply[_] = + private def deserializeStatusReplySuccess(bytes: Array[Byte]): StatusReply[?] = StatusReply.success(payloadSupport.deserializePayload(ContainerFormats.Payload.parseFrom(bytes))) - private def deserializeStatusReplyErrorMessage(bytes: Array[Byte]): StatusReply[_] = + private def deserializeStatusReplyErrorMessage(bytes: Array[Byte]): StatusReply[?] = StatusReply.error(ContainerFormats.StatusReplyErrorMessage.parseFrom(bytes).getErrorMessage) - private def deserializeStatusReplyErrorException(bytes: Array[Byte]): StatusReply[_] = + private def deserializeStatusReplyErrorException(bytes: Array[Byte]): StatusReply[?] = StatusReply.error( payloadSupport.deserializePayload(ContainerFormats.Payload.parseFrom(bytes)).asInstanceOf[Throwable]) diff --git a/remote/src/main/scala/org/apache/pekko/remote/serialization/PrimitiveSerializers.scala b/remote/src/main/scala/org/apache/pekko/remote/serialization/PrimitiveSerializers.scala index 28f5b84de2a..a51caca1f15 100644 --- a/remote/src/main/scala/org/apache/pekko/remote/serialization/PrimitiveSerializers.scala +++ b/remote/src/main/scala/org/apache/pekko/remote/serialization/PrimitiveSerializers.scala @@ -30,7 +30,7 @@ class LongSerializer(val system: ExtendedActorSystem) extends BaseSerializer wit override def toBinary(o: AnyRef, buf: ByteBuffer): Unit = delegate.toBinary(o, buf) override def fromBinary(buf: ByteBuffer, manifest: String): AnyRef = delegate.fromBinary(buf, manifest) override def toBinary(o: AnyRef): Array[Byte] = delegate.toBinary(o) - override def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = delegate.fromBinary(bytes, manifest) + override def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = delegate.fromBinary(bytes, manifest) } @deprecated("Moved to org.apache.pekko.serialization.IntSerializer in pekko-actor", "Akka 2.6.0") @@ -43,7 +43,7 @@ class IntSerializer(val system: ExtendedActorSystem) extends BaseSerializer with override def toBinary(o: AnyRef, buf: ByteBuffer): Unit = delegate.toBinary(o, buf) override def fromBinary(buf: ByteBuffer, manifest: String): AnyRef = delegate.fromBinary(buf, manifest) override def toBinary(o: AnyRef): Array[Byte] = delegate.toBinary(o) - override def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = delegate.fromBinary(bytes, manifest) + override def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = delegate.fromBinary(bytes, manifest) } @deprecated("Moved to org.apache.pekko.serialization.StringSerializer in pekko-actor", "Akka 2.6.0") @@ -56,7 +56,7 @@ class StringSerializer(val system: ExtendedActorSystem) extends BaseSerializer w override def toBinary(o: AnyRef, buf: ByteBuffer): Unit = delegate.toBinary(o, buf) override def fromBinary(buf: ByteBuffer, manifest: String): AnyRef = delegate.fromBinary(buf, manifest) override def toBinary(o: AnyRef): Array[Byte] = delegate.toBinary(o) - override def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = delegate.fromBinary(bytes, manifest) + override def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = delegate.fromBinary(bytes, manifest) } @deprecated("Moved to org.apache.pekko.serialization.ByteStringSerializer in pekko-actor", "Akka 2.6.0") @@ -69,5 +69,5 @@ class ByteStringSerializer(val system: ExtendedActorSystem) extends BaseSerializ override def toBinary(o: AnyRef, buf: ByteBuffer): Unit = delegate.toBinary(o, buf) override def fromBinary(buf: ByteBuffer, manifest: String): AnyRef = delegate.fromBinary(buf, manifest) override def toBinary(o: AnyRef): Array[Byte] = delegate.toBinary(o) - override def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = delegate.fromBinary(bytes, manifest) + override def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = delegate.fromBinary(bytes, manifest) } diff --git a/remote/src/main/scala/org/apache/pekko/remote/serialization/ProtobufSerializer.scala b/remote/src/main/scala/org/apache/pekko/remote/serialization/ProtobufSerializer.scala index d52f00d331f..26c6fce92fe 100644 --- a/remote/src/main/scala/org/apache/pekko/remote/serialization/ProtobufSerializer.scala +++ b/remote/src/main/scala/org/apache/pekko/remote/serialization/ProtobufSerializer.scala @@ -28,7 +28,7 @@ import pekko.serialization.{ BaseSerializer, Serialization } import pekko.serialization.SerializationExtension object ProtobufSerializer { - private val ARRAY_OF_BYTE_ARRAY = Array[Class[_]](classOf[Array[Byte]]) + private val ARRAY_OF_BYTE_ARRAY = Array[Class[?]](classOf[Array[Byte]]) /** * Helper to serialize an [[pekko.actor.ActorRef]] to Pekko's @@ -56,8 +56,8 @@ object ProtobufSerializer { */ class ProtobufSerializer(val system: ExtendedActorSystem) extends BaseSerializer { - private val parsingMethodBindingRef = new AtomicReference[Map[Class[_], Method]](Map.empty) - private val toByteArrayMethodBindingRef = new AtomicReference[Map[Class[_], Method]](Map.empty) + private val parsingMethodBindingRef = new AtomicReference[Map[Class[?], Method]](Map.empty) + private val toByteArrayMethodBindingRef = new AtomicReference[Map[Class[?], Method]](Map.empty) private val allowedClassNames: Set[String] = { import pekko.util.ccompat.JavaConverters._ @@ -71,7 +71,7 @@ class ProtobufSerializer(val system: ExtendedActorSystem) extends BaseSerializer override def includeManifest: Boolean = true - override def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = { + override def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = { manifest match { case Some(clazz) => @tailrec @@ -121,7 +121,7 @@ class ProtobufSerializer(val system: ExtendedActorSystem) extends BaseSerializer toByteArrayMethod().invoke(obj).asInstanceOf[Array[Byte]] } - private def checkAllowedClass(clazz: Class[_]): Unit = { + private def checkAllowedClass(clazz: Class[?]): Unit = { if (!isInAllowList(clazz)) { val warnMsg = s"Can't deserialize object of type [${clazz.getName}] in [${getClass.getName}]. " + "Only classes that are on the allow list are allowed for security reasons. " + @@ -147,11 +147,11 @@ class ProtobufSerializer(val system: ExtendedActorSystem) extends BaseSerializer * That is also possible when changing a binding from a ProtobufSerializer to another serializer (e.g. Jackson) * and still bind with the same class (interface). */ - private def isInAllowList(clazz: Class[_]): Boolean = { + private def isInAllowList(clazz: Class[?]): Boolean = { isBoundToProtobufSerializer(clazz) || isInAllowListClassName(clazz) } - private def isBoundToProtobufSerializer(clazz: Class[_]): Boolean = { + private def isBoundToProtobufSerializer(clazz: Class[?]): Boolean = { try { val boundSerializer = serialization.serializerFor(clazz) boundSerializer.isInstanceOf[ProtobufSerializer] @@ -160,7 +160,7 @@ class ProtobufSerializer(val system: ExtendedActorSystem) extends BaseSerializer } } - private def isInAllowListClassName(clazz: Class[_]): Boolean = { + private def isInAllowListClassName(clazz: Class[?]): Boolean = { allowedClassNames(clazz.getName) || allowedClassNames(clazz.getSuperclass.getName) || clazz.getInterfaces.exists(c => allowedClassNames(c.getName)) diff --git a/remote/src/main/scala/org/apache/pekko/remote/serialization/SystemMessageSerializer.scala b/remote/src/main/scala/org/apache/pekko/remote/serialization/SystemMessageSerializer.scala index 58bd95d3924..714fecc91a1 100644 --- a/remote/src/main/scala/org/apache/pekko/remote/serialization/SystemMessageSerializer.scala +++ b/remote/src/main/scala/org/apache/pekko/remote/serialization/SystemMessageSerializer.scala @@ -97,7 +97,7 @@ class SystemMessageSerializer(val system: ExtendedActorSystem) extends BaseSeria builder.build().toByteArray } - override def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = { + override def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = { deserializeSystemMessage(SystemMessageFormats.SystemMessage.parseFrom(bytes)) } 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 fb76ecb83f8..08cbefc6eca 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 @@ -138,13 +138,13 @@ object RemoteInstrumentsSerializationSpec { class Filter(@unused settings: ActorSystem.Settings, stream: EventStream) extends LoggingFilter { stream.publish(Mute(EventFilter.debug())) - override def isErrorEnabled(logClass: Class[_], logSource: String): Boolean = true + override def isErrorEnabled(logClass: Class[?], logSource: String): Boolean = true - override def isWarningEnabled(logClass: Class[_], logSource: String): Boolean = true + override def isWarningEnabled(logClass: Class[?], logSource: String): Boolean = true - override def isInfoEnabled(logClass: Class[_], logSource: String): Boolean = true + override def isInfoEnabled(logClass: Class[?], logSource: String): Boolean = true - override def isDebugEnabled(logClass: Class[_], logSource: String): Boolean = logSource == "DebugSource" + override def isDebugEnabled(logClass: Class[?], logSource: String): Boolean = logSource == "DebugSource" } def testInstrument( 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 1773f9c5a09..42c79cf4d7d 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 @@ -64,8 +64,8 @@ private[pekko] trait SerializationVerification { self: PekkoSpec => got.props.args.length should ===(expected.props.args.length) got.props.args.zip(expected.props.args).foreach { case (g, e) => - if (e.isInstanceOf[Function0[_]]) () - else if (e.isInstanceOf[Function1[_, _]]) () + if (e.isInstanceOf[Function0[?]]) () + else if (e.isInstanceOf[Function1[?, ?]]) () else g should ===(e) } got.props.deploy should ===(expected.props.deploy) diff --git a/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/JacksonModule.scala b/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/JacksonModule.scala index cbb0a2dae3c..4fb52d3ff8a 100644 --- a/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/JacksonModule.scala +++ b/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/JacksonModule.scala @@ -43,12 +43,12 @@ import pekko.annotation.InternalApi VersionUtil.parseVersion(version, groupId, artifactId) } - class SerializerResolverByClass(clazz: Class[_], deserializer: () => JsonSerializer[_]) extends Serializers.Base { + class SerializerResolverByClass(clazz: Class[?], deserializer: () => JsonSerializer[?]) extends Serializers.Base { override def findSerializer( config: SerializationConfig, javaType: JavaType, - beanDesc: BeanDescription): JsonSerializer[_] = { + beanDesc: BeanDescription): JsonSerializer[?] = { if (clazz.isAssignableFrom(javaType.getRawClass)) deserializer() else @@ -57,12 +57,12 @@ import pekko.annotation.InternalApi } - class DeserializerResolverByClass(clazz: Class[_], serializer: () => JsonDeserializer[_]) extends Deserializers.Base { + class DeserializerResolverByClass(clazz: Class[?], serializer: () => JsonDeserializer[?]) extends Deserializers.Base { override def findBeanDeserializer( javaType: JavaType, config: DeserializationConfig, - beanDesc: BeanDescription): JsonDeserializer[_] = { + beanDesc: BeanDescription): JsonDeserializer[?] = { if (clazz.isAssignableFrom(javaType.getRawClass)) serializer() else @@ -94,9 +94,9 @@ import pekko.annotation.InternalApi } def addSerializer( - clazz: Class[_], - serializer: () => JsonSerializer[_], - deserializer: () => JsonDeserializer[_]): this.type = { + clazz: Class[?], + serializer: () => JsonSerializer[?], + deserializer: () => JsonDeserializer[?]): this.type = { this += { ctx => ctx.addSerializers(new SerializerResolverByClass(clazz, serializer)) ctx.addDeserializers(new DeserializerResolverByClass(clazz, deserializer)) diff --git a/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/JacksonSerializer.scala b/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/JacksonSerializer.scala index a400ba0de61..b73911ddad8 100644 --- a/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/JacksonSerializer.scala +++ b/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/JacksonSerializer.scala @@ -61,14 +61,14 @@ import pekko.util.OptionVal true } - def isAllowedClass(clazz: Class[_]): Boolean = { + def isAllowedClass(clazz: Class[?]): Boolean = { if (clazz.getName.startsWith(prefixSpring)) { isAllowedSpringClass(clazz) } else true } - @tailrec private def isAllowedSpringClass(clazz: Class[_]): Boolean = { + @tailrec private def isAllowedSpringClass(clazz: Class[?]): Boolean = { if (clazz == null || clazz.equals(classOf[java.lang.Object])) true else { @@ -84,8 +84,8 @@ import pekko.util.OptionVal } } - val disallowedSerializationBindings: Set[Class[_]] = - Set(classOf[java.io.Serializable], classOf[java.io.Serializable], classOf[java.lang.Comparable[_]]) + val disallowedSerializationBindings: Set[Class[?]] = + Set(classOf[java.io.Serializable], classOf[java.io.Serializable], classOf[java.lang.Comparable[?]]) def isGZipped(bytes: Array[Byte]): Boolean = { (bytes != null) && (bytes.length >= 2) && @@ -221,7 +221,7 @@ import pekko.util.OptionVal } private val typeInManifest: Boolean = conf.getBoolean("type-in-manifest") // Calculated eagerly so as to fail fast - private val configuredDeserializationType: Option[Class[_ <: AnyRef]] = conf.getString("deserialization-type") match { + private val configuredDeserializationType: Option[Class[? <: AnyRef]] = conf.getString("deserialization-type") match { case "" => None case className => system.dynamicAccess.getClassFor[AnyRef](className) match { @@ -236,7 +236,7 @@ import pekko.util.OptionVal private lazy val serialization = SerializationExtension(system) // This must be lazy since it depends on serialization above - private lazy val deserializationType: Option[Class[_ <: AnyRef]] = if (typeInManifest) { + private lazy val deserializationType: Option[Class[? <: AnyRef]] = if (typeInManifest) { None } else { configuredDeserializationType.orElse { @@ -395,7 +395,7 @@ import pekko.util.OptionVal bytes: Array[Byte], decompressBytes: Array[Byte], startTime: Long, - clazz: Class[_ <: AnyRef]) = { + clazz: Class[? <: AnyRef]) = { if (isDebugEnabled) { val durationMicros = (System.nanoTime - startTime) / 1000 if (bytes.length == decompressBytes.length) @@ -426,7 +426,7 @@ import pekko.util.OptionVal } } - private def checkAllowedClass(clazz: Class[_]): Unit = { + private def checkAllowedClass(clazz: Class[?]): Unit = { if (!denyList.isAllowedClass(clazz)) { val warnMsg = s"Can't serialize/deserialize object of type [${clazz.getName}] in [${getClass.getName}]. " + s"Not allowed for security reasons." @@ -457,11 +457,11 @@ import pekko.util.OptionVal * That is also possible when changing a binding from a JacksonSerializer to another serializer (e.g. protobuf) * and still bind with the same class (interface). */ - private def isInAllowList(clazz: Class[_]): Boolean = { + private def isInAllowList(clazz: Class[?]): Boolean = { isBoundToJacksonSerializer(clazz) || hasAllowedClassPrefix(clazz.getName) } - private def isBoundToJacksonSerializer(clazz: Class[_]): Boolean = { + private def isBoundToJacksonSerializer(clazz: Class[?]): Boolean = { try { // The reason for using isInstanceOf rather than `eq this` is to allow change of // serializer within the Jackson family, but we don't trust other serializers @@ -485,7 +485,7 @@ import pekko.util.OptionVal */ private def checkAllowedSerializationBindings(): Unit = { if (!serializationBindingsCheckedOk) { - def isBindingOk(clazz: Class[_]): Boolean = + def isBindingOk(clazz: Class[?]): Boolean = try { serialization.serializerFor(clazz) ne this } catch { diff --git a/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/StreamRefModule.scala b/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/StreamRefModule.scala index 3d588271e11..59cd8a56ad8 100644 --- a/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/StreamRefModule.scala +++ b/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/StreamRefModule.scala @@ -33,8 +33,8 @@ import pekko.stream.StreamRefResolver * INTERNAL API: Adds support for serializing and deserializing [[pekko.stream.SourceRef]] and [[pekko.stream.SinkRef]]. */ @InternalApi private[pekko] trait StreamRefModule extends JacksonModule { - addSerializer(classOf[SourceRef[_]], () => SourceRefSerializer.instance, () => SourceRefDeserializer.instance) - addSerializer(classOf[SinkRef[_]], () => SinkRefSerializer.instance, () => SinkRefDeserializer.instance) + addSerializer(classOf[SourceRef[?]], () => SourceRefSerializer.instance, () => SourceRefDeserializer.instance) + addSerializer(classOf[SinkRef[?]], () => SinkRefSerializer.instance, () => SinkRefDeserializer.instance) } /** @@ -48,10 +48,10 @@ import pekko.stream.StreamRefResolver * INTERNAL API */ @InternalApi private[pekko] class SourceRefSerializer - extends StdScalarSerializer[SourceRef[_]](classOf[SourceRef[_]]) + extends StdScalarSerializer[SourceRef[?]](classOf[SourceRef[?]]) with ActorSystemAccess { - override def serialize(value: SourceRef[_], jgen: JsonGenerator, provider: SerializerProvider): Unit = { + override def serialize(value: SourceRef[?], jgen: JsonGenerator, provider: SerializerProvider): Unit = { val resolver = StreamRefResolver(currentSystem()) val serializedSourceRef = resolver.toSerializationFormat(value) jgen.writeString(serializedSourceRef) @@ -69,15 +69,15 @@ import pekko.stream.StreamRefResolver * INTERNAL API */ @InternalApi private[pekko] class SourceRefDeserializer - extends StdScalarDeserializer[SourceRef[_]](classOf[SourceRef[_]]) + extends StdScalarDeserializer[SourceRef[?]](classOf[SourceRef[?]]) with ActorSystemAccess { - def deserialize(jp: JsonParser, ctxt: DeserializationContext): SourceRef[_] = { + def deserialize(jp: JsonParser, ctxt: DeserializationContext): SourceRef[?] = { if (jp.currentTokenId() == JsonTokenId.ID_STRING) { val serializedSourceRef = jp.getText() StreamRefResolver(currentSystem()).resolveSourceRef(serializedSourceRef) } else - ctxt.handleUnexpectedToken(handledType(), jp).asInstanceOf[SourceRef[_]] + ctxt.handleUnexpectedToken(handledType(), jp).asInstanceOf[SourceRef[?]] } } @@ -92,10 +92,10 @@ import pekko.stream.StreamRefResolver * INTERNAL API */ @InternalApi private[pekko] class SinkRefSerializer - extends StdScalarSerializer[SinkRef[_]](classOf[SinkRef[_]]) + extends StdScalarSerializer[SinkRef[?]](classOf[SinkRef[?]]) with ActorSystemAccess { - override def serialize(value: SinkRef[_], jgen: JsonGenerator, provider: SerializerProvider): Unit = { + override def serialize(value: SinkRef[?], jgen: JsonGenerator, provider: SerializerProvider): Unit = { val resolver = StreamRefResolver(currentSystem()) val serializedSinkRef = resolver.toSerializationFormat(value) jgen.writeString(serializedSinkRef) @@ -113,14 +113,14 @@ import pekko.stream.StreamRefResolver * INTERNAL API */ @InternalApi private[pekko] class SinkRefDeserializer - extends StdScalarDeserializer[SinkRef[_]](classOf[SinkRef[_]]) + extends StdScalarDeserializer[SinkRef[?]](classOf[SinkRef[?]]) with ActorSystemAccess { - def deserialize(jp: JsonParser, ctxt: DeserializationContext): SinkRef[_] = { + def deserialize(jp: JsonParser, ctxt: DeserializationContext): SinkRef[?] = { if (jp.currentTokenId() == JsonTokenId.ID_STRING) { val serializedSinkref = jp.getText() StreamRefResolver(currentSystem()).resolveSinkRef(serializedSinkref) } else - ctxt.handleUnexpectedToken(handledType(), jp).asInstanceOf[SinkRef[_]] + ctxt.handleUnexpectedToken(handledType(), jp).asInstanceOf[SinkRef[?]] } } diff --git a/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/TypedActorRefModule.scala b/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/TypedActorRefModule.scala index 7d73b1c944e..0862ded911b 100644 --- a/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/TypedActorRefModule.scala +++ b/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/TypedActorRefModule.scala @@ -31,7 +31,7 @@ import pekko.annotation.InternalApi * INTERNAL API: Adds support for serializing and deserializing [[pekko.actor.typed.ActorRef]]. */ @InternalApi private[pekko] trait TypedActorRefModule extends JacksonModule { - addSerializer(classOf[ActorRef[_]], () => TypedActorRefSerializer.instance, () => TypedActorRefDeserializer.instance) + addSerializer(classOf[ActorRef[?]], () => TypedActorRefSerializer.instance, () => TypedActorRefDeserializer.instance) } /** @@ -45,9 +45,9 @@ import pekko.annotation.InternalApi * INTERNAL API */ @InternalApi private[pekko] class TypedActorRefSerializer - extends StdScalarSerializer[ActorRef[_]](classOf[ActorRef[_]]) + extends StdScalarSerializer[ActorRef[?]](classOf[ActorRef[?]]) with ActorSystemAccess { - override def serialize(value: ActorRef[_], jgen: JsonGenerator, provider: SerializerProvider): Unit = { + override def serialize(value: ActorRef[?], jgen: JsonGenerator, provider: SerializerProvider): Unit = { val serializedActorRef = ActorRefResolver(currentSystem().toTyped).toSerializationFormat(value) jgen.writeString(serializedActorRef) } @@ -64,14 +64,14 @@ import pekko.annotation.InternalApi * INTERNAL API */ @InternalApi private[pekko] class TypedActorRefDeserializer - extends StdScalarDeserializer[ActorRef[_]](classOf[ActorRef[_]]) + extends StdScalarDeserializer[ActorRef[?]](classOf[ActorRef[?]]) with ActorSystemAccess { - def deserialize(jp: JsonParser, ctxt: DeserializationContext): ActorRef[_] = { + def deserialize(jp: JsonParser, ctxt: DeserializationContext): ActorRef[?] = { if (jp.currentTokenId() == JsonTokenId.ID_STRING) { val serializedActorRef = jp.getText() ActorRefResolver(currentSystem().toTyped).resolveActorRef(serializedActorRef) } else - ctxt.handleUnexpectedToken(handledType(), jp).asInstanceOf[ActorRef[_]] + ctxt.handleUnexpectedToken(handledType(), jp).asInstanceOf[ActorRef[?]] } } 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 7fbc1fae372..1b1c13b2dc1 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 @@ -46,7 +46,7 @@ object Logger { * @param logSource - the textual representation of the source of this log stream * @return a Logger for the specified parameters */ - def apply(logClass: Class[_], logSource: String): SLFLogger = logClass match { + def apply(logClass: Class[?], logSource: String): SLFLogger = logClass match { case c if c == classOf[DummyClassForStringSources] => apply(logSource) case _ => SLFLoggerFactory.getLogger(logClass) } @@ -170,13 +170,13 @@ class Slf4jLogger extends Actor with SLF4JLogging with RequiresMessageQueue[Logg */ class Slf4jLoggingFilter(@unused settings: ActorSystem.Settings, eventStream: EventStream) extends LoggingFilterWithMarker { - def isErrorEnabled(logClass: Class[_], logSource: String) = + def isErrorEnabled(logClass: Class[?], logSource: String) = (eventStream.logLevel >= ErrorLevel) && Logger(logClass, logSource).isErrorEnabled - def isWarningEnabled(logClass: Class[_], logSource: String) = + def isWarningEnabled(logClass: Class[?], logSource: String) = (eventStream.logLevel >= WarningLevel) && Logger(logClass, logSource).isWarnEnabled - def isInfoEnabled(logClass: Class[_], logSource: String) = + def isInfoEnabled(logClass: Class[?], logSource: String) = (eventStream.logLevel >= InfoLevel) && Logger(logClass, logSource).isInfoEnabled - def isDebugEnabled(logClass: Class[_], logSource: String) = + def isDebugEnabled(logClass: Class[?], logSource: String) = (eventStream.logLevel >= DebugLevel) && Logger(logClass, logSource).isDebugEnabled private def slf4jMarker(marker: LogMarker) = marker match { @@ -185,13 +185,13 @@ class Slf4jLoggingFilter(@unused settings: ActorSystem.Settings, eventStream: Ev case marker => MarkerFactory.getMarker(marker.name) } - override def isErrorEnabled(logClass: Class[_], logSource: String, marker: LogMarker): Boolean = + override def isErrorEnabled(logClass: Class[?], logSource: String, marker: LogMarker): Boolean = (eventStream.logLevel >= ErrorLevel) && Logger(logClass, logSource).isErrorEnabled(slf4jMarker(marker)) - override def isWarningEnabled(logClass: Class[_], logSource: String, marker: LogMarker): Boolean = + override def isWarningEnabled(logClass: Class[?], logSource: String, marker: LogMarker): Boolean = (eventStream.logLevel >= WarningLevel) && Logger(logClass, logSource).isWarnEnabled(slf4jMarker(marker)) - override def isInfoEnabled(logClass: Class[_], logSource: String, marker: LogMarker): Boolean = + override def isInfoEnabled(logClass: Class[?], logSource: String, marker: LogMarker): Boolean = (eventStream.logLevel >= InfoLevel) && Logger(logClass, logSource).isInfoEnabled(slf4jMarker(marker)) - override def isDebugEnabled(logClass: Class[_], logSource: String, marker: LogMarker): Boolean = + override def isDebugEnabled(logClass: Class[?], logSource: String, marker: LogMarker): Boolean = (eventStream.logLevel >= DebugLevel) && Logger(logClass, logSource).isDebugEnabled(slf4jMarker(marker)) } diff --git a/stream-testkit/src/main/scala/org/apache/pekko/stream/testkit/StreamTestKit.scala b/stream-testkit/src/main/scala/org/apache/pekko/stream/testkit/StreamTestKit.scala index fe10aee6246..5d8f708624d 100644 --- a/stream-testkit/src/main/scala/org/apache/pekko/stream/testkit/StreamTestKit.scala +++ b/stream-testkit/src/main/scala/org/apache/pekko/stream/testkit/StreamTestKit.scala @@ -57,7 +57,7 @@ object TestPublisher { * Publisher that subscribes the subscriber and completes after the first request. */ def lazyEmpty[T]: Publisher[T] = new Publisher[T] { - override def subscribe(subscriber: Subscriber[_ >: T]): Unit = + override def subscribe(subscriber: Subscriber[? >: T]): Unit = subscriber.onSubscribe(CompletedSubscription(subscriber)) } @@ -70,7 +70,7 @@ object TestPublisher { * Publisher that subscribes the subscriber and signals error after the first request. */ def lazyError[T](cause: Throwable): Publisher[T] = new Publisher[T] { - override def subscribe(subscriber: Subscriber[_ >: T]): Unit = + override def subscribe(subscriber: Subscriber[? >: T]): Unit = subscriber.onSubscribe(FailedSubscription(subscriber, cause)) } @@ -122,7 +122,7 @@ object TestPublisher { /** * Subscribes a given [[org.reactivestreams.Subscriber]] to this probe publisher. */ - def subscribe(subscriber: Subscriber[_ >: I]): Unit = { + def subscribe(subscriber: Subscriber[? >: I]): Unit = { val subscription: PublisherProbeSubscription[I] = new PublisherProbeSubscription[I](subscriber, probe) probe.ref ! Subscribe(subscription) if (autoOnSubscribe) subscriber.onSubscribe(subscription) @@ -910,7 +910,7 @@ private[stream] object StreamTestKit { override def cancel(): Unit = () } - final case class PublisherProbeSubscription[I](subscriber: Subscriber[_ >: I], publisherProbe: TestProbe) + final case class PublisherProbeSubscription[I](subscriber: Subscriber[? >: I], publisherProbe: TestProbe) extends Subscription with SubscriptionWithCancelException { def request(elements: Long): Unit = publisherProbe.ref ! RequestMore(this, elements) diff --git a/stream-testkit/src/test/scala/org/apache/pekko/stream/impl/fusing/GraphInterpreterSpecKit.scala b/stream-testkit/src/test/scala/org/apache/pekko/stream/impl/fusing/GraphInterpreterSpecKit.scala index 0cdbafea717..85439090e50 100644 --- a/stream-testkit/src/test/scala/org/apache/pekko/stream/impl/fusing/GraphInterpreterSpecKit.scala +++ b/stream-testkit/src/test/scala/org/apache/pekko/stream/impl/fusing/GraphInterpreterSpecKit.scala @@ -102,19 +102,19 @@ object GraphInterpreterSpecKit { * @return Created logics and the maps of all inlets respective outlets to those logics */ private[stream] def createLogics( - stages: Array[GraphStageWithMaterializedValue[_ <: Shape, _]], - upstreams: Array[UpstreamBoundaryStageLogic[_]], - downstreams: Array[DownstreamBoundaryStageLogic[_]], + stages: Array[GraphStageWithMaterializedValue[? <: Shape, ?]], + upstreams: Array[UpstreamBoundaryStageLogic[?]], + downstreams: Array[DownstreamBoundaryStageLogic[?]], attributes: Array[Attributes] = Array.empty)(implicit system: ActorSystem) - : (Array[GraphStageLogic], SMap[Inlet[_], GraphStageLogic], SMap[Outlet[_], GraphStageLogic]) = { + : (Array[GraphStageLogic], SMap[Inlet[?], GraphStageLogic], SMap[Outlet[?], GraphStageLogic]) = { if (attributes.nonEmpty && attributes.length != stages.length) throw new IllegalArgumentException("Attributes must be either empty or one per stage") @nowarn("msg=deprecated") val defaultAttributes = ActorMaterializerSettings(system).toAttributes - var inOwners = SMap.empty[Inlet[_], GraphStageLogic] - var outOwners = SMap.empty[Outlet[_], GraphStageLogic] + var inOwners = SMap.empty[Inlet[?], GraphStageLogic] + var outOwners = SMap.empty[Outlet[?], GraphStageLogic] val logics = new Array[GraphStageLogic](upstreams.length + stages.length + downstreams.length) var idx = 0 @@ -212,9 +212,9 @@ object GraphInterpreterSpecKit { * Create interpreter connections for all the given `connectedPorts`. */ private[stream] def createConnections( - connectedPorts: Seq[(Outlet[_], Inlet[_])], - inOwners: SMap[Inlet[_], GraphStageLogic], - outOwners: SMap[Outlet[_], GraphStageLogic]): Array[Connection] = { + connectedPorts: Seq[(Outlet[?], Inlet[?])], + inOwners: SMap[Inlet[?], GraphStageLogic], + outOwners: SMap[Outlet[?], GraphStageLogic]): Array[Connection] = { val connections = new Array[Connection](connectedPorts.size) connectedPorts.zipWithIndex.foreach { @@ -245,7 +245,7 @@ object GraphInterpreterSpecKit { } } - private def setPortIds(stage: GraphStageWithMaterializedValue[_ <: Shape, _]): Unit = { + private def setPortIds(stage: GraphStageWithMaterializedValue[? <: Shape, ?]): Unit = { stage.shape.inlets.zipWithIndex.foreach { case (inlet, idx) => inlet.id = idx } stage.shape.outlets.zipWithIndex.foreach { case (inlet, idx) => inlet.id = idx } } @@ -302,10 +302,10 @@ trait GraphInterpreterSpecKit extends StreamSpec { override def toString = "Downstream" } - class AssemblyBuilder(operators: Seq[GraphStageWithMaterializedValue[_ <: Shape, _]]) { - private var upstreams = Vector.empty[UpstreamBoundaryStageLogic[_]] - private var downstreams = Vector.empty[DownstreamBoundaryStageLogic[_]] - private var connectedPorts = Vector.empty[(Outlet[_], Inlet[_])] + class AssemblyBuilder(operators: Seq[GraphStageWithMaterializedValue[? <: Shape, ?]]) { + private var upstreams = Vector.empty[UpstreamBoundaryStageLogic[?]] + private var downstreams = Vector.empty[DownstreamBoundaryStageLogic[?]] + private var connectedPorts = Vector.empty[(Outlet[?], Inlet[?])] def connect[T](upstream: UpstreamBoundaryStageLogic[T], in: Inlet[T]): AssemblyBuilder = { upstreams :+= upstream @@ -349,7 +349,7 @@ trait GraphInterpreterSpecKit extends StreamSpec { _interpreter.init(null) } - def builder(operators: GraphStageWithMaterializedValue[_ <: Shape, _]*): AssemblyBuilder = + def builder(operators: GraphStageWithMaterializedValue[? <: Shape, ?]*): AssemblyBuilder = new AssemblyBuilder(operators.toVector) } diff --git a/stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/ChainSetup.scala b/stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/ChainSetup.scala index bc824c6835b..7e6e7b51244 100644 --- a/stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/ChainSetup.scala +++ b/stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/ChainSetup.scala @@ -30,13 +30,13 @@ class ChainSetup[In, Out, M]( stream: Flow[In, In, NotUsed] => Flow[In, Out, M], val settings: ActorMaterializerSettings, materializer: Materializer, - toPublisher: (Source[Out, _], Materializer) => Publisher[Out])(implicit val system: ActorSystem) { + toPublisher: (Source[Out, ?], Materializer) => Publisher[Out])(implicit val system: ActorSystem) { @nowarn("msg=deprecated") def this( stream: Flow[In, In, NotUsed] => Flow[In, Out, M], settings: ActorMaterializerSettings, - toPublisher: (Source[Out, _], Materializer) => Publisher[Out])(implicit system: ActorSystem) = + toPublisher: (Source[Out, ?], Materializer) => Publisher[Out])(implicit system: ActorSystem) = this(stream, settings, ActorMaterializer(settings)(system), toPublisher)(system) @nowarn("msg=deprecated") @@ -44,7 +44,7 @@ class ChainSetup[In, Out, M]( stream: Flow[In, In, NotUsed] => Flow[In, Out, M], settings: ActorMaterializerSettings, materializerCreator: (ActorMaterializerSettings, ActorRefFactory) => Materializer, - toPublisher: (Source[Out, _], Materializer) => Publisher[Out])(implicit system: ActorSystem) = + toPublisher: (Source[Out, ?], Materializer) => Publisher[Out])(implicit system: ActorSystem) = this(stream, settings, materializerCreator(settings, system), toPublisher)(system) val upstream = TestPublisher.manualProbe[In]() diff --git a/stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/ScriptedTest.scala b/stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/ScriptedTest.scala index 0f4925556fe..6b2cbeac99f 100644 --- a/stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/ScriptedTest.scala +++ b/stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/ScriptedTest.scala @@ -39,7 +39,7 @@ trait ScriptedTest extends Matchers { class ScriptException(msg: String) extends RuntimeException(msg) - def toPublisher[In, Out]: (Source[Out, _], Materializer) => Publisher[Out] = + def toPublisher[In, Out]: (Source[Out, ?], Materializer) => Publisher[Out] = (f, m) => f.runWith(Sink.asPublisher(false))(m) object Script { diff --git a/stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/StreamSpec.scala b/stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/StreamSpec.scala index 827a3c4918c..bb003f0fc2e 100644 --- a/stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/StreamSpec.scala +++ b/stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/StreamSpec.scala @@ -39,7 +39,7 @@ abstract class StreamSpec(_system: ActorSystem) extends PekkoSpec(_system) { def this(s: String) = this(ConfigFactory.parseString(s)) - def this(configMap: Map[String, _]) = this(PekkoSpec.mapToConfig(configMap)) + def this(configMap: Map[String, ?]) = this(PekkoSpec.mapToConfig(configMap)) def this() = this(ActorSystem(TestKitUtils.testNameFromCallStack(classOf[StreamSpec], "".r), PekkoSpec.testConf)) diff --git a/stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/TwoStreamsSetup.scala b/stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/TwoStreamsSetup.scala index 16960ae5abb..90cc495ba64 100644 --- a/stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/TwoStreamsSetup.scala +++ b/stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/TwoStreamsSetup.scala @@ -27,7 +27,7 @@ abstract class TwoStreamsSetup extends BaseTwoStreamsSetup { def out: Outlet[Outputs] } - def fixture(b: GraphDSL.Builder[_]): Fixture + def fixture(b: GraphDSL.Builder[?]): Fixture override def setup(p1: Publisher[Int], p2: Publisher[Int]) = { val subscriber = TestSubscriber.probe[Outputs]() diff --git a/stream-tests-tck/src/test/scala/org/apache/pekko/stream/tck/FlatMapConcatDoubleSubscriberTest.scala b/stream-tests-tck/src/test/scala/org/apache/pekko/stream/tck/FlatMapConcatDoubleSubscriberTest.scala index e9083d675ad..a07272ec7ef 100644 --- a/stream-tests-tck/src/test/scala/org/apache/pekko/stream/tck/FlatMapConcatDoubleSubscriberTest.scala +++ b/stream-tests-tck/src/test/scala/org/apache/pekko/stream/tck/FlatMapConcatDoubleSubscriberTest.scala @@ -26,7 +26,7 @@ class FlatMapConcatDoubleSubscriberTest extends PekkoSubscriberBlackboxVerificat val subscriber = Promise[Subscriber[Int]]() Source .single(Source.fromPublisher(new Publisher[Int] { - def subscribe(s: Subscriber[_ >: Int]): Unit = + def subscribe(s: Subscriber[? >: Int]): Unit = subscriber.success(s.asInstanceOf[Subscriber[Int]]) })) .flatten diff --git a/stream-tests-tck/src/test/scala/org/apache/pekko/stream/tck/PekkoIdentityProcessorVerification.scala b/stream-tests-tck/src/test/scala/org/apache/pekko/stream/tck/PekkoIdentityProcessorVerification.scala index e1ee6f24f8a..8b3a36c81bb 100644 --- a/stream-tests-tck/src/test/scala/org/apache/pekko/stream/tck/PekkoIdentityProcessorVerification.scala +++ b/stream-tests-tck/src/test/scala/org/apache/pekko/stream/tck/PekkoIdentityProcessorVerification.scala @@ -46,7 +46,7 @@ abstract class PekkoIdentityProcessorVerification[T](env: TestEnvironment, publi override def onError(t: Throwable): Unit = sub.onError(t) override def onComplete(): Unit = sub.onComplete() override def onNext(t: T): Unit = sub.onNext(t) - override def subscribe(s: Subscriber[_ >: T]): Unit = pub.subscribe(s) + override def subscribe(s: Subscriber[? >: T]): Unit = pub.subscribe(s) } } diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/DslConsistencySpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/DslConsistencySpec.scala index ce1d60bee92..fddeeba1494 100755 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/DslConsistencySpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/DslConsistencySpec.scala @@ -38,23 +38,23 @@ object DslConsistencySpec { class DslConsistencySpec extends AnyWordSpec with Matchers { - val sFlowClass: Class[_] = classOf[pekko.stream.scaladsl.Flow[_, _, _]] - val jFlowClass: Class[_] = classOf[pekko.stream.javadsl.Flow[_, _, _]] + val sFlowClass: Class[?] = classOf[pekko.stream.scaladsl.Flow[?, ?, ?]] + val jFlowClass: Class[?] = classOf[pekko.stream.javadsl.Flow[?, ?, ?]] - val sSubFlowClass: Class[_] = classOf[DslConsistencySpec.ScalaSubFlow[_, _, _]] - val jSubFlowClass: Class[_] = classOf[pekko.stream.javadsl.SubFlow[_, _, _]] + val sSubFlowClass: Class[?] = classOf[DslConsistencySpec.ScalaSubFlow[?, ?, ?]] + val jSubFlowClass: Class[?] = classOf[pekko.stream.javadsl.SubFlow[?, ?, ?]] - val sSourceClass: Class[_] = classOf[pekko.stream.scaladsl.Source[_, _]] - val jSourceClass: Class[_] = classOf[pekko.stream.javadsl.Source[_, _]] + val sSourceClass: Class[?] = classOf[pekko.stream.scaladsl.Source[?, ?]] + val jSourceClass: Class[?] = classOf[pekko.stream.javadsl.Source[?, ?]] - val sSubSourceClass: Class[_] = classOf[DslConsistencySpec.ScalaSubSource[_, _]] - val jSubSourceClass: Class[_] = classOf[pekko.stream.javadsl.SubSource[_, _]] + val sSubSourceClass: Class[?] = classOf[DslConsistencySpec.ScalaSubSource[?, ?]] + val jSubSourceClass: Class[?] = classOf[pekko.stream.javadsl.SubSource[?, ?]] - val sSinkClass: Class[_] = classOf[pekko.stream.scaladsl.Sink[_, _]] - val jSinkClass: Class[_] = classOf[pekko.stream.javadsl.Sink[_, _]] + val sSinkClass: Class[?] = classOf[pekko.stream.scaladsl.Sink[?, ?]] + val jSinkClass: Class[?] = classOf[pekko.stream.javadsl.Sink[?, ?]] - val jRunnableGraphClass: Class[_] = classOf[pekko.stream.javadsl.RunnableGraph[_]] - val sRunnableGraphClass: Class[_] = classOf[pekko.stream.scaladsl.RunnableGraph[_]] + val jRunnableGraphClass: Class[?] = classOf[pekko.stream.javadsl.RunnableGraph[?]] + val sRunnableGraphClass: Class[?] = classOf[pekko.stream.scaladsl.RunnableGraph[?]] val ignore: Set[String] = Set("equals", "hashCode", "notify", "notifyAll", "wait", "toString", "getClass") ++ @@ -95,7 +95,7 @@ class DslConsistencySpec extends AnyWordSpec with Matchers { val forComprehensions = Set("withFilter", "flatMap", "foreach") - val allowMissing: Map[Class[_], Set[String]] = Map( + val allowMissing: Map[Class[?], Set[String]] = Map( jFlowClass -> (graphHelpers ++ forComprehensions), jSourceClass -> (graphHelpers ++ forComprehensions ++ Set("watch", "ask")), // Java subflows can only be nested using .via and .to (due to type system restrictions) @@ -113,7 +113,7 @@ class DslConsistencySpec extends AnyWordSpec with Matchers { @nowarn def materializing(m: Method): Boolean = m.getParameterTypes.contains(classOf[ActorMaterializer]) - def assertHasMethod(c: Class[_], name: String): Unit = { + def assertHasMethod(c: Class[?], name: String): Unit = { // include class name to get better error message if (!allowMissing.getOrElse(c, Set.empty).contains(name)) c.getMethods.collect { case m if !ignore(m.getName) => c.getName + "." + m.getName } should contain( @@ -122,12 +122,12 @@ class DslConsistencySpec extends AnyWordSpec with Matchers { "Java and Scala DSLs" must { - (("Source" -> List[Class[_]](sSourceClass, jSourceClass)) :: - ("SubSource" -> List[Class[_]](sSubSourceClass, jSubSourceClass)) :: - ("Flow" -> List[Class[_]](sFlowClass, jFlowClass)) :: - ("SubFlow" -> List[Class[_]](sSubFlowClass, jSubFlowClass)) :: - ("Sink" -> List[Class[_]](sSinkClass, jSinkClass)) :: - ("RunnableFlow" -> List[Class[_]](sRunnableGraphClass, jRunnableGraphClass)) :: + (("Source" -> List[Class[?]](sSourceClass, jSourceClass)) :: + ("SubSource" -> List[Class[?]](sSubSourceClass, jSubSourceClass)) :: + ("Flow" -> List[Class[?]](sFlowClass, jFlowClass)) :: + ("SubFlow" -> List[Class[?]](sSubFlowClass, jSubFlowClass)) :: + ("Sink" -> List[Class[?]](sSinkClass, jSinkClass)) :: + ("RunnableFlow" -> List[Class[?]](sRunnableGraphClass, jRunnableGraphClass)) :: Nil).foreach { case (element, classes) => s"provide same $element transforming operators" in { diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/DslFactoriesConsistencySpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/DslFactoriesConsistencySpec.scala index df715bbf13f..fcad0e073a9 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/DslFactoriesConsistencySpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/DslFactoriesConsistencySpec.scala @@ -77,26 +77,26 @@ class DslFactoriesConsistencySpec extends AnyWordSpec with Matchers { (2 to 22) .map { i => (Class.forName(s"scala.Function$i"), Class.forName(s"org.apache.pekko.japi.function.Function$i")) }.toList // format: ON - val sSource = classOf[scaladsl.Source[_, _]] - val jSource = classOf[javadsl.Source[_, _]] + val sSource = classOf[scaladsl.Source[?, ?]] + val jSource = classOf[javadsl.Source[?, ?]] - val sSink = classOf[scaladsl.Sink[_, _]] - val jSink = classOf[javadsl.Sink[_, _]] + val sSink = classOf[scaladsl.Sink[?, ?]] + val jSink = classOf[javadsl.Sink[?, ?]] - val sFlow = classOf[scaladsl.Flow[_, _, _]] - val jFlow = classOf[javadsl.Flow[_, _, _]] + val sFlow = classOf[scaladsl.Flow[?, ?, ?]] + val jFlow = classOf[javadsl.Flow[?, ?, ?]] - val sRunnableGraph = classOf[scaladsl.RunnableGraph[_]] - val jRunnableGraph = classOf[javadsl.RunnableGraph[_]] + val sRunnableGraph = classOf[scaladsl.RunnableGraph[?]] + val jRunnableGraph = classOf[javadsl.RunnableGraph[?]] - val graph = classOf[Graph[_, _]] + val graph = classOf[Graph[?, ?]] - case class TestCase(name: String, sClass: Option[Class[_]], jClass: Option[Class[_]], jFactory: Option[Class[_]]) + case class TestCase(name: String, sClass: Option[Class[?]], jClass: Option[Class[?]], jFactory: Option[Class[?]]) object TestCase { - def apply(name: String, sClass: Class[_], jClass: Class[_], jFactory: Class[_]): TestCase = + def apply(name: String, sClass: Class[?], jClass: Class[?], jFactory: Class[?]): TestCase = TestCase(name, Some(sClass), Some(jClass), Some(jFactory)) - def apply(name: String, sClass: Class[_], jClass: Class[_]): TestCase = + def apply(name: String, sClass: Class[?], jClass: Class[?]): TestCase = TestCase(name, Some(sClass), Some(jClass), None) } @@ -134,19 +134,19 @@ class DslFactoriesConsistencySpec extends AnyWordSpec with Matchers { // here be dragons... - private def getJMethods(jClass: Class[_]): List[Method] = + private def getJMethods(jClass: Class[?]): List[Method] = jClass.getDeclaredMethods.filterNot(javaIgnore contains _.getName).map(toMethod).filterNot(ignore).toList - private def getSMethods(sClass: Class[_]): List[Method] = + private def getSMethods(sClass: Class[?]): List[Method] = sClass.getMethods.filterNot(scalaIgnore contains _.getName).map(toMethod).filterNot(ignore).toList private def toMethod(m: java.lang.reflect.Method): Method = Method(m.getName, List(m.getParameterTypes.toIndexedSeq: _*), m.getReturnType, m.getDeclaringClass) private case class Ignore( - cls: Class[_] => Boolean, + cls: Class[?] => Boolean, name: String => Boolean, parameters: Int => Boolean, - paramTypes: List[Class[_]] => Boolean) + paramTypes: List[Class[?]] => Boolean) private def ignore(m: Method): Boolean = { val ignores = Seq( @@ -155,7 +155,7 @@ class DslFactoriesConsistencySpec extends AnyWordSpec with Matchers { _ == pekko.stream.scaladsl.Source.getClass, _ == "apply", _ == 1, - _ == List(classOf[pekko.stream.impl.SourceModule[_, _]])), + _ == List(classOf[pekko.stream.impl.SourceModule[?, ?]])), // corresponding matches on java side would need to have Function23 Ignore(_ == pekko.stream.scaladsl.Source.getClass, _ == "apply", _ == 24, _ => true), Ignore(_ == pekko.stream.scaladsl.Flow.getClass, _ == "apply", _ == 24, _ => true), @@ -197,7 +197,7 @@ class DslFactoriesConsistencySpec extends AnyWordSpec with Matchers { case m if m.parameterTypes.size > 1 => m.copy( name = m.name.filter(Character.isLetter), - parameterTypes = m.parameterTypes.dropRight(1) :+ classOf[pekko.japi.function.Function[_, _]]) + parameterTypes = m.parameterTypes.dropRight(1) :+ classOf[pekko.japi.function.Function[?, ?]]) case m => m } @@ -251,7 +251,7 @@ class DslFactoriesConsistencySpec extends AnyWordSpec with Matchers { def returnTypeString(m: Method): String = m.returnType.getName.drop("pekko.stream.".length) - case class Method(name: String, parameterTypes: List[Class[_]], returnType: Class[_], declaringClass: Class[_]) + case class Method(name: String, parameterTypes: List[Class[?]], returnType: Class[?], declaringClass: Class[?]) sealed trait MatchResult { def j: Method @@ -290,21 +290,21 @@ class DslFactoriesConsistencySpec extends AnyWordSpec with Matchers { * Keyed elements in scaladsl must also be keyed elements in javadsl. * If scaladsl is not a keyed type, javadsl shouldn't be as well. */ - def returnTypeMatch(s: Class[_], j: Class[_]): Boolean = + def returnTypeMatch(s: Class[?], j: Class[?]): Boolean = (sSource.isAssignableFrom(s) && jSource.isAssignableFrom(j)) || (sSink.isAssignableFrom(s) && jSink.isAssignableFrom(j)) || (sFlow.isAssignableFrom(s) && jFlow.isAssignableFrom(j)) || (sRunnableGraph.isAssignableFrom(s) && jRunnableGraph.isAssignableFrom(j)) || (graph.isAssignableFrom(s) && graph.isAssignableFrom(j)) - def typeMatch(scalaParams: List[Class[_]], javaParams: List[Class[_]]): Boolean = + def typeMatch(scalaParams: List[Class[?]], javaParams: List[Class[?]]): Boolean = (scalaParams.toList, javaParams.toList) match { case (s, j) if s == j => true case (s, j) if s.zip(j).forall(typeMatch) => true case _ => false } - def typeMatch(p: (Class[_], Class[_])): Boolean = + def typeMatch(p: (Class[?], Class[?])): Boolean = if (p._1 == p._2) true else if (`scala -> java types` contains p) true else false diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/impl/FixedBufferSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/impl/FixedBufferSpec.scala index 1ad64742591..25f5437fdbe 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/impl/FixedBufferSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/impl/FixedBufferSpec.scala @@ -141,19 +141,19 @@ class FixedBufferSpec extends StreamSpec { } "produce BoundedBuffers when capacity > max-fixed-buffer-size" in { - Buffer(Int.MaxValue, default) shouldBe a[BoundedBuffer[_]] + Buffer(Int.MaxValue, default) shouldBe a[BoundedBuffer[?]] } "produce FixedSizeBuffers when capacity < max-fixed-buffer-size" in { - Buffer(1000, default) shouldBe a[FixedSizeBuffer.ModuloFixedSizeBuffer[_]] - Buffer(1024, default) shouldBe a[FixedSizeBuffer.PowerOfTwoFixedSizeBuffer[_]] + Buffer(1000, default) shouldBe a[FixedSizeBuffer.ModuloFixedSizeBuffer[?]] + Buffer(1024, default) shouldBe a[FixedSizeBuffer.PowerOfTwoFixedSizeBuffer[?]] } "produce FixedSizeBuffers when max-fixed-buffer-size < BoundedBufferSize" in { val settings = default and ActorAttributes.maxFixedBufferSize(9) - Buffer(5, settings) shouldBe a[FixedSizeBuffer.ModuloFixedSizeBuffer[_]] - Buffer(10, settings) shouldBe a[FixedSizeBuffer.ModuloFixedSizeBuffer[_]] - Buffer(16, settings) shouldBe a[FixedSizeBuffer.PowerOfTwoFixedSizeBuffer[_]] + Buffer(5, settings) shouldBe a[FixedSizeBuffer.ModuloFixedSizeBuffer[?]] + Buffer(10, settings) shouldBe a[FixedSizeBuffer.ModuloFixedSizeBuffer[?]] + Buffer(16, settings) shouldBe a[FixedSizeBuffer.PowerOfTwoFixedSizeBuffer[?]] } } diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/impl/fusing/ActorGraphInterpreterSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/impl/fusing/ActorGraphInterpreterSpec.scala index 770a5caaae7..6b12845738e 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/impl/fusing/ActorGraphInterpreterSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/impl/fusing/ActorGraphInterpreterSpec.scala @@ -374,7 +374,7 @@ class ActorGraphInterpreterSpec extends StreamSpec { "be able to handle Publisher spec violations without leaking" in { val filthyPublisher = new Publisher[Int] { - override def subscribe(s: Subscriber[_ >: Int]): Unit = { + override def subscribe(s: Subscriber[? >: Int]): Unit = { s.onSubscribe(new Subscription { override def cancel(): Unit = () override def request(n: Long): Unit = throw TE("violating your spec") @@ -468,7 +468,7 @@ class ActorGraphInterpreterSpec extends StreamSpec { val done = Promise[Done]() Source .single(Source.fromPublisher(new Publisher[Int] { - def subscribe(s: Subscriber[_ >: Int]): Unit = { + def subscribe(s: Subscriber[? >: Int]): Unit = { s.onSubscribe(new Subscription { def cancel(): Unit = () def request(n: Long): Unit = () diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/CoupledTerminationFlowSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/CoupledTerminationFlowSpec.scala index 2e6f914833b..636aeb8522d 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/CoupledTerminationFlowSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/CoupledTerminationFlowSpec.scala @@ -112,7 +112,7 @@ class CoupledTerminationFlowSpec extends StreamSpec(""" val probe = TestProbe() val f = Flow.fromSinkAndSourceCoupledMat(Sink.cancelled, Source.fromPublisher(new Publisher[String] { - override def subscribe(subscriber: Subscriber[_ >: String]): Unit = { + override def subscribe(subscriber: Subscriber[? >: String]): Unit = { subscriber.onSubscribe(new Subscription { override def cancel(): Unit = probe.ref ! "cancelled" @@ -159,7 +159,7 @@ class CoupledTerminationFlowSpec extends StreamSpec(""" val downstreamEffect = Sink.onComplete(s => probe.ref ! s) val upstreamEffect = Source.fromPublisher(new Publisher[String] { - override def subscribe(s: Subscriber[_ >: String]): Unit = + override def subscribe(s: Subscriber[? >: String]): Unit = s.onSubscribe(new Subscription { override def cancel(): Unit = probe.ref ! "cancel-received" diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowCompileSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowCompileSpec.scala index 21ae42a0e40..9f4e5ebed26 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowCompileSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowCompileSpec.scala @@ -34,47 +34,47 @@ class FlowCompileSpec extends StreamSpec { "Flow" should { "not run" in { - val open: Flow[Int, Int, _] = Flow[Int] + val open: Flow[Int, Int, ?] = Flow[Int] "open.run()" shouldNot compile } "accept Iterable" in { - val f: Source[Int, _] = intSeq.via(Flow[Int]) + val f: Source[Int, ?] = intSeq.via(Flow[Int]) } "accept Future" in { - val f: Source[Int, _] = intFut.via(Flow[Int]) + val f: Source[Int, ?] = intFut.via(Flow[Int]) } "append Flow" in { - val open1: Flow[Int, String, _] = Flow[Int].map(_.toString) - val open2: Flow[String, Int, _] = Flow[String].map(_.hashCode) - val open3: Flow[Int, Int, _] = open1.via(open2) + val open1: Flow[Int, String, ?] = Flow[Int].map(_.toString) + val open2: Flow[String, Int, ?] = Flow[String].map(_.hashCode) + val open3: Flow[Int, Int, ?] = open1.via(open2) "open3.run()" shouldNot compile - val closedSource: Source[Int, _] = intSeq.via(open3) - val closedSink: Sink[Int, _] = open3.to(Sink.asPublisher[Int](false)) + val closedSource: Source[Int, ?] = intSeq.via(open3) + val closedSink: Sink[Int, ?] = open3.to(Sink.asPublisher[Int](false)) "closedSink.run()" shouldNot compile closedSource.to(Sink.asPublisher[Int](false)).run() intSeq.to(closedSink).run() } "append Sink" in { - val open: Flow[Int, String, _] = Flow[Int].map(_.toString) - val closedSink: Sink[String, _] = Flow[String].map(_.hashCode).to(Sink.asPublisher[Int](false)) - val appended: Sink[Int, _] = open.to(closedSink) + val open: Flow[Int, String, ?] = Flow[Int].map(_.toString) + val closedSink: Sink[String, ?] = Flow[String].map(_.hashCode).to(Sink.asPublisher[Int](false)) + val appended: Sink[Int, ?] = open.to(closedSink) "appended.run()" shouldNot compile "appended.to(Sink.head[Int])" shouldNot compile intSeq.to(appended).run() } "be appended to Source" in { - val open: Flow[Int, String, _] = Flow[Int].map(_.toString) - val closedSource: Source[Int, _] = strSeq.via(Flow[String].map(_.hashCode)) - val closedSource2: Source[String, _] = closedSource.via(open) + val open: Flow[Int, String, ?] = Flow[Int].map(_.toString) + val closedSource: Source[Int, ?] = strSeq.via(Flow[String].map(_.hashCode)) + val closedSource2: Source[String, ?] = closedSource.via(open) "strSeq.to(closedSource2)" shouldNot compile closedSource2.to(Sink.asPublisher[String](false)).run() } } "Sink" should { - val openSink: Sink[Int, _] = + val openSink: Sink[Int, ?] = Flow[Int].map(_.toString).to(Sink.asPublisher[String](false)) "accept Source" in { intSeq.to(openSink) @@ -88,7 +88,7 @@ class FlowCompileSpec extends StreamSpec { } "Source" should { - val openSource: Source[String, _] = + val openSource: Source[String, ?] = Source(Seq(1, 2, 3)).map(_.toString) "accept Sink" in { openSource.to(Sink.asPublisher[String](false)) diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowConcatAllSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowConcatAllSpec.scala index 47b73352f31..89bf57b86b1 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowConcatAllSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowConcatAllSpec.scala @@ -117,7 +117,7 @@ class FlowConcatAllSpec extends StreamSpec(""" } "on onError on opening substream, cancel the master stream and signal error " in { - val publisher = TestPublisher.manualProbe[Source[Int, _]]() + val publisher = TestPublisher.manualProbe[Source[Int, ?]]() val subscriber = TestSubscriber.manualProbe[Int]() Source.fromPublisher(publisher).flatMapConcat(_ => throw testException).to(Sink.fromSubscriber(subscriber)).run() diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowConcatSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowConcatSpec.scala index a862104028b..0d41fd44d4e 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowConcatSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowConcatSpec.scala @@ -49,9 +49,9 @@ abstract class AbstractFlowConcatSpec extends BaseTwoStreamsSetup { s"${if (eager) "An eager" else "A lazy"} Concat for Flow " must { "be able to concat Flow with a Source" in { - val f1: Flow[Int, String, _] = Flow[Int].map(_.toString + "-s") - val s1: Source[Int, _] = Source(List(1, 2, 3)) - val s2: Source[String, _] = Source(List(4, 5, 6)).map(_.toString + "-s") + val f1: Flow[Int, String, ?] = Flow[Int].map(_.toString + "-s") + val s1: Source[Int, ?] = Source(List(1, 2, 3)) + val s2: Source[String, ?] = Source(List(4, 5, 6)).map(_.toString + "-s") val subs = TestSubscriber.manualProbe[Any]() val subSink = Sink.asPublisher[Any](false) @@ -67,9 +67,9 @@ abstract class AbstractFlowConcatSpec extends BaseTwoStreamsSetup { } "be able to prepend a Source to a Flow" in { - val s1: Source[String, _] = Source(List(1, 2, 3)).map(_.toString + "-s") - val s2: Source[Int, _] = Source(List(4, 5, 6)) - val f2: Flow[Int, String, _] = Flow[Int].map(_.toString + "-s") + val s1: Source[String, ?] = Source(List(1, 2, 3)).map(_.toString + "-s") + val s2: Source[Int, ?] = Source(List(4, 5, 6)) + val f2: Flow[Int, String, ?] = Flow[Int].map(_.toString + "-s") val subs = TestSubscriber.manualProbe[Any]() val subSink = Sink.asPublisher[Any](false) diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowGroupBySpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowGroupBySpec.scala index 2ae158cb8aa..8909deb8f15 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowGroupBySpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowGroupBySpec.scala @@ -75,17 +75,17 @@ class FlowGroupBySpec extends StreamSpec(""" val max = if (maxSubstreams > 0) maxSubstreams else groupCount val groupStream = Source.fromPublisher(source).groupBy(max, _ % groupCount).lift(_ % groupCount).runWith(Sink.asPublisher(false)) - val masterSubscriber = TestSubscriber.manualProbe[(Int, Source[Int, _])]() + val masterSubscriber = TestSubscriber.manualProbe[(Int, Source[Int, ?])]() groupStream.subscribe(masterSubscriber) val masterSubscription = masterSubscriber.expectSubscription() - def getSubFlow(expectedKey: Int): Source[Int, _] = { + def getSubFlow(expectedKey: Int): Source[Int, ?] = { masterSubscription.request(1) expectSubFlow(expectedKey) } - def expectSubFlow(expectedKey: Int): Source[Int, _] = { + def expectSubFlow(expectedKey: Int): Source[Int, ?] = { val (key, substream) = masterSubscriber.expectNext() key should be(expectedKey) substream @@ -184,7 +184,7 @@ class FlowGroupBySpec extends StreamSpec(""" val publisherProbeProbe = TestPublisher.manualProbe[Int]() val publisher = Source.fromPublisher(publisherProbeProbe).groupBy(2, _ % 2).lift(_ % 2).runWith(Sink.asPublisher(false)) - val subscriber = TestSubscriber.manualProbe[(Int, Source[Int, _])]() + val subscriber = TestSubscriber.manualProbe[(Int, Source[Int, ?])]() publisher.subscribe(subscriber) val upstreamSubscription = publisherProbeProbe.expectSubscription() @@ -195,7 +195,7 @@ class FlowGroupBySpec extends StreamSpec(""" "work with empty input stream" in { val publisher = Source(List.empty[Int]).groupBy(2, _ % 2).lift(_ % 2).runWith(Sink.asPublisher(false)) - val subscriber = TestSubscriber.manualProbe[(Int, Source[Int, _])]() + val subscriber = TestSubscriber.manualProbe[(Int, Source[Int, ?])]() publisher.subscribe(subscriber) subscriber.expectSubscriptionAndComplete() @@ -205,7 +205,7 @@ class FlowGroupBySpec extends StreamSpec(""" val publisherProbeProbe = TestPublisher.manualProbe[Int]() val publisher = Source.fromPublisher(publisherProbeProbe).groupBy(2, _ % 2).lift(_ % 2).runWith(Sink.asPublisher(false)) - val subscriber = TestSubscriber.manualProbe[(Int, Source[Int, _])]() + val subscriber = TestSubscriber.manualProbe[(Int, Source[Int, ?])]() publisher.subscribe(subscriber) val upstreamSubscription = publisherProbeProbe.expectSubscription() @@ -223,7 +223,7 @@ class FlowGroupBySpec extends StreamSpec(""" val publisherProbeProbe = TestPublisher.manualProbe[Int]() val publisher = Source.fromPublisher(publisherProbeProbe).groupBy(2, _ % 2).lift(_ % 2).runWith(Sink.asPublisher(false)) - val subscriber = TestSubscriber.manualProbe[(Int, Source[Int, _])]() + val subscriber = TestSubscriber.manualProbe[(Int, Source[Int, ?])]() publisher.subscribe(subscriber) val upstreamSubscription = publisherProbeProbe.expectSubscription() diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowOnCompleteSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowOnCompleteSpec.scala index d2badf0e408..120130e5a7a 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowOnCompleteSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowOnCompleteSpec.scala @@ -98,7 +98,7 @@ class FlowOnCompleteSpec extends StreamSpec(""" proc.expectRequest() mat.shutdown() - onCompleteProbe.expectMsgType[Failure[_]] + onCompleteProbe.expectMsgType[Failure[?]] } } diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowPrefixAndTailSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowPrefixAndTailSpec.scala index c148cb61232..79b662b72e4 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowPrefixAndTailSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowPrefixAndTailSpec.scala @@ -32,7 +32,7 @@ class FlowPrefixAndTailSpec extends StreamSpec(""" val testException = new Exception("test") with NoStackTrace - def newHeadSink = Sink.head[(immutable.Seq[Int], Source[Int, _])] + def newHeadSink = Sink.head[(immutable.Seq[Int], Source[Int, ?])] "work on empty input" in { val futureSink = newHeadSink @@ -171,7 +171,7 @@ class FlowPrefixAndTailSpec extends StreamSpec(""" "handle onError when no substream open" in { val publisher = TestPublisher.manualProbe[Int]() - val subscriber = TestSubscriber.manualProbe[(immutable.Seq[Int], Source[Int, _])]() + val subscriber = TestSubscriber.manualProbe[(immutable.Seq[Int], Source[Int, ?])]() Source.fromPublisher(publisher).prefixAndTail(3).to(Sink.fromSubscriber(subscriber)).run() @@ -189,7 +189,7 @@ class FlowPrefixAndTailSpec extends StreamSpec(""" "handle onError when substream is open" in { val publisher = TestPublisher.manualProbe[Int]() - val subscriber = TestSubscriber.manualProbe[(immutable.Seq[Int], Source[Int, _])]() + val subscriber = TestSubscriber.manualProbe[(immutable.Seq[Int], Source[Int, ?])]() Source.fromPublisher(publisher).prefixAndTail(1).to(Sink.fromSubscriber(subscriber)).run() @@ -216,7 +216,7 @@ class FlowPrefixAndTailSpec extends StreamSpec(""" "handle master stream cancellation" in { val publisher = TestPublisher.manualProbe[Int]() - val subscriber = TestSubscriber.manualProbe[(immutable.Seq[Int], Source[Int, _])]() + val subscriber = TestSubscriber.manualProbe[(immutable.Seq[Int], Source[Int, ?])]() Source.fromPublisher(publisher).prefixAndTail(3).to(Sink.fromSubscriber(subscriber)).run() @@ -234,7 +234,7 @@ class FlowPrefixAndTailSpec extends StreamSpec(""" "handle substream cancellation" in { val publisher = TestPublisher.manualProbe[Int]() - val subscriber = TestSubscriber.manualProbe[(immutable.Seq[Int], Source[Int, _])]() + val subscriber = TestSubscriber.manualProbe[(immutable.Seq[Int], Source[Int, ?])]() Source.fromPublisher(publisher).prefixAndTail(1).to(Sink.fromSubscriber(subscriber)).run() @@ -260,7 +260,7 @@ class FlowPrefixAndTailSpec extends StreamSpec(""" "pass along early cancellation" in { val up = TestPublisher.manualProbe[Int]() - val down = TestSubscriber.manualProbe[(immutable.Seq[Int], Source[Int, _])]() + val down = TestSubscriber.manualProbe[(immutable.Seq[Int], Source[Int, ?])]() val flowSubscriber = Source.asSubscriber[Int].prefixAndTail(1).to(Sink.fromSubscriber(down)).run() diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowScanAsyncSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowScanAsyncSpec.scala index 53548f6fc70..d41e454d44d 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowScanAsyncSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowScanAsyncSpec.scala @@ -276,7 +276,7 @@ class FlowScanAsyncSpec extends StreamSpec with Matchers { elements: immutable.Seq[String], zero: String, decider: Supervision.Decider = Supervision.stoppingDecider): Probe[String] = { - val nullFutureScanFlow: Flow[String, String, _] = Flow[String].scanAsync(zero) { (_: String, next: String) => + val nullFutureScanFlow: Flow[String, String, ?] = Flow[String].scanAsync(zero) { (_: String, next: String) => if (next != "null") Future(next) else Future(null) } diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowSpec.scala index 632f98a320e..b3213a66176 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowSpec.scala @@ -58,13 +58,13 @@ class FlowSpec extends StreamSpec(ConfigFactory.parseString("pekko.actor.debug.r val identity: Flow[Any, Any, NotUsed] => Flow[Any, Any, NotUsed] = in => in.map(e => e) val identity2: Flow[Any, Any, NotUsed] => Flow[Any, Any, NotUsed] = in => identity(in) - val toPublisher: (Source[Any, _], Materializer) => Publisher[Any] = + val toPublisher: (Source[Any, ?], Materializer) => Publisher[Any] = (f, m) => f.runWith(Sink.asPublisher(false))(m) - def toFanoutPublisher[In, Out](elasticity: Int): (Source[Out, _], Materializer) => Publisher[Out] = + def toFanoutPublisher[In, Out](elasticity: Int): (Source[Out, ?], Materializer) => Publisher[Out] = (f, m) => f.runWith(Sink.asPublisher(true).withAttributes(Attributes.inputBuffer(elasticity, elasticity)))(m) - def materializeIntoSubscriberAndPublisher[In, Out](flow: Flow[In, Out, _]): (Subscriber[In], Publisher[Out]) = { + def materializeIntoSubscriberAndPublisher[In, Out](flow: Flow[In, Out, ?]): (Subscriber[In], Publisher[Out]) = { flow.runWith(Source.asSubscriber[In], Sink.asPublisher[Out](false)) } @@ -196,9 +196,9 @@ class FlowSpec extends StreamSpec(ConfigFactory.parseString("pekko.actor.debug.r } "subscribe Subscriber" in { - val flow: Flow[String, String, _] = Flow[String] + val flow: Flow[String, String, ?] = Flow[String] val c1 = TestSubscriber.manualProbe[String]() - val sink: Sink[String, _] = flow.to(Sink.fromSubscriber(c1)) + val sink: Sink[String, ?] = flow.to(Sink.fromSubscriber(c1)) val publisher: Publisher[String] = Source(List("1", "2", "3")).runWith(Sink.asPublisher(false)) Source.fromPublisher(publisher).to(sink).run() @@ -240,7 +240,7 @@ class FlowSpec extends StreamSpec(ConfigFactory.parseString("pekko.actor.debug.r "perform transformation operation and subscribe Subscriber" in { val flow = Flow[Int].map(_.toString) val c1 = TestSubscriber.manualProbe[String]() - val sink: Sink[Int, _] = flow.to(Sink.fromSubscriber(c1)) + val sink: Sink[Int, ?] = flow.to(Sink.fromSubscriber(c1)) val publisher: Publisher[Int] = Source(List(1, 2, 3)).runWith(Sink.asPublisher(false)) Source.fromPublisher(publisher).to(sink).run() @@ -286,18 +286,18 @@ class FlowSpec extends StreamSpec(ConfigFactory.parseString("pekko.actor.debug.r } "be covariant" in { - val f1: Source[Fruit, _] = Source.fromIterator[Fruit](fruits) + val f1: Source[Fruit, ?] = Source.fromIterator[Fruit](fruits) val p1: Publisher[Fruit] = Source.fromIterator[Fruit](fruits).runWith(Sink.asPublisher(false)) - val f2: SubFlow[Fruit, _, Source[Fruit, NotUsed]#Repr, _] = + val f2: SubFlow[Fruit, ?, Source[Fruit, NotUsed]#Repr, ?] = Source.fromIterator[Fruit](fruits).splitWhen(_ => true) - val f3: SubFlow[Fruit, _, Source[Fruit, NotUsed]#Repr, _] = + val f3: SubFlow[Fruit, ?, Source[Fruit, NotUsed]#Repr, ?] = Source.fromIterator[Fruit](fruits).groupBy(2, _ => true) - val f4: Source[(immutable.Seq[Fruit], Source[Fruit, _]), _] = Source.fromIterator[Fruit](fruits).prefixAndTail(1) - val d1: SubFlow[Fruit, _, Flow[String, Fruit, NotUsed]#Repr, _] = + val f4: Source[(immutable.Seq[Fruit], Source[Fruit, ?]), ?] = Source.fromIterator[Fruit](fruits).prefixAndTail(1) + val d1: SubFlow[Fruit, ?, Flow[String, Fruit, NotUsed]#Repr, ?] = Flow[String].map(_ => new Apple).splitWhen(_ => true) - val d2: SubFlow[Fruit, _, Flow[String, Fruit, NotUsed]#Repr, _] = + val d2: SubFlow[Fruit, ?, Flow[String, Fruit, NotUsed]#Repr, ?] = Flow[String].map(_ => new Apple).groupBy(2, _ => true) - val d3: Flow[String, (immutable.Seq[Apple], Source[Fruit, _]), _] = + val d3: Flow[String, (immutable.Seq[Apple], Source[Fruit, ?]), ?] = Flow[String].map(_ => new Apple).prefixAndTail(1) } diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowSplitAfterSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowSplitAfterSpec.scala index da91f8af0df..77b47ccc322 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowSplitAfterSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowSplitAfterSpec.scala @@ -68,17 +68,17 @@ class FlowSplitAfterSpec extends StreamSpec(""" .lift .withAttributes(ActorAttributes.supervisionStrategy(decider)) .runWith(Sink.asPublisher(false)) - val masterSubscriber = TestSubscriber.manualProbe[Source[Int, _]]() + val masterSubscriber = TestSubscriber.manualProbe[Source[Int, ?]]() groupStream.subscribe(masterSubscriber) val masterSubscription = masterSubscriber.expectSubscription() - def expectSubFlow(): Source[Int, _] = { + def expectSubFlow(): Source[Int, ?] = { masterSubscription.request(1) expectSubPublisher() } - def expectSubPublisher(): Source[Int, _] = { + def expectSubPublisher(): Source[Int, ?] = { val substream = masterSubscriber.expectNext() substream } diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowSplitWhenSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowSplitWhenSpec.scala index 58c6238eac5..be464c0a15c 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowSplitWhenSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowSplitWhenSpec.scala @@ -61,17 +61,17 @@ class FlowSplitWhenSpec extends StreamSpec(""" .lift .withAttributes(ActorAttributes.supervisionStrategy(decider)) .runWith(Sink.asPublisher(false)) - val masterSubscriber = TestSubscriber.manualProbe[Source[Int, _]]() + val masterSubscriber = TestSubscriber.manualProbe[Source[Int, ?]]() groupStream.subscribe(masterSubscriber) val masterSubscription = masterSubscriber.expectSubscription() - def getSubFlow(): Source[Int, _] = { + def getSubFlow(): Source[Int, ?] = { masterSubscription.request(1) expectSubPublisher() } - def expectSubPublisher(): Source[Int, _] = { + def expectSubPublisher(): Source[Int, ?] = { val substream = masterSubscriber.expectNext() substream } diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowTakeSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowTakeSpec.scala index d6cee2b546b..cc51de854bd 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowTakeSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowTakeSpec.scala @@ -28,7 +28,7 @@ class FlowTakeSpec extends StreamSpec(""" pekko.stream.materializer.initial-input-buffer-size = 2 """) with ScriptedTest { - muteDeadLetters(classOf[OnNext], OnComplete.getClass, classOf[RequestMore[_]])() + muteDeadLetters(classOf[OnNext], OnComplete.getClass, classOf[RequestMore[?]])() "A Take" must { diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphConcatSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphConcatSpec.scala index 0c3eebf7fd7..c778c0fad67 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphConcatSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphConcatSpec.scala @@ -24,7 +24,7 @@ class GraphConcatSpec extends TwoStreamsSetup { override type Outputs = Int - override def fixture(b: GraphDSL.Builder[_]): Fixture = new Fixture { + override def fixture(b: GraphDSL.Builder[?]): Fixture = new Fixture { val concat = b.add(Concat[Outputs]()) override def left: Inlet[Outputs] = concat.in(0) diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergeLatestSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergeLatestSpec.scala index 72008509fe4..12f8dbd09d4 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergeLatestSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergeLatestSpec.scala @@ -27,7 +27,7 @@ class GraphMergeLatestSpec extends TwoStreamsSetup { override type Outputs = List[Int] - override def fixture(b: GraphDSL.Builder[_]): Fixture = new Fixture { + override def fixture(b: GraphDSL.Builder[?]): Fixture = new Fixture { val merge = b.add(MergeLatest[Int](2)) override def left: Inlet[Int] = merge.in(0) diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergePreferredSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergePreferredSpec.scala index 1b916977d99..64ee4fbe64c 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergePreferredSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergePreferredSpec.scala @@ -27,7 +27,7 @@ class GraphMergePreferredSpec extends TwoStreamsSetup { override type Outputs = Int - override def fixture(b: GraphDSL.Builder[_]): Fixture = new Fixture { + override def fixture(b: GraphDSL.Builder[?]): Fixture = new Fixture { val merge = b.add(MergePreferred[Outputs](1)) override def left: Inlet[Outputs] = merge.preferred diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergePrioritizedSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergePrioritizedSpec.scala index 6b6e7fc9257..df9eacc7c71 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergePrioritizedSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergePrioritizedSpec.scala @@ -26,7 +26,7 @@ class GraphMergePrioritizedSpec extends TwoStreamsSetup { override type Outputs = Int - override def fixture(b: GraphDSL.Builder[_]): Fixture = new Fixture { + override def fixture(b: GraphDSL.Builder[?]): Fixture = new Fixture { val mergePrioritized = b.add(MergePrioritized[Outputs](Seq(2, 8))) override def left: Inlet[Outputs] = mergePrioritized.in(0) diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergeSequenceSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergeSequenceSpec.scala index f39bd724a7a..38c4f8323d4 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergeSequenceSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergeSequenceSpec.scala @@ -27,7 +27,7 @@ class GraphMergeSequenceSpec extends TwoStreamsSetup { override type Outputs = Int - override def fixture(b: GraphDSL.Builder[_]): Fixture = new Fixture { + override def fixture(b: GraphDSL.Builder[?]): Fixture = new Fixture { val merge = b.add(MergeSequence[Outputs](2)(i => i)) override def left: Inlet[Outputs] = merge.in(0) diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergeSortedSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergeSortedSpec.scala index efc3728fca6..b9fd83a9dce 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergeSortedSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergeSortedSpec.scala @@ -28,7 +28,7 @@ class GraphMergeSortedSpec extends TwoStreamsSetup with ScalaCheckPropertyChecks override type Outputs = Int - override def fixture(b: GraphDSL.Builder[_]): Fixture = new Fixture { + override def fixture(b: GraphDSL.Builder[?]): Fixture = new Fixture { val merge = b.add(new MergeSorted[Outputs]) override def left: Inlet[Outputs] = merge.in0 diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergeSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergeSpec.scala index 0c91bde3a34..e75f2598c7c 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergeSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergeSpec.scala @@ -26,7 +26,7 @@ class GraphMergeSpec extends TwoStreamsSetup { override type Outputs = Int - override def fixture(b: GraphDSL.Builder[_]): Fixture = new Fixture { + override def fixture(b: GraphDSL.Builder[?]): Fixture = new Fixture { val merge = b.add(Merge[Outputs](2)) override def left: Inlet[Outputs] = merge.in(0) diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphOpsIntegrationSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphOpsIntegrationSpec.scala index 4886b5d7cb8..cef5e97de79 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphOpsIntegrationSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphOpsIntegrationSpec.scala @@ -30,13 +30,13 @@ object GraphOpsIntegrationSpec { case class ShufflePorts[In, Out](in1: Inlet[In], in2: Inlet[In], out1: Outlet[Out], out2: Outlet[Out]) extends Shape { - override def inlets: immutable.Seq[Inlet[_]] = List(in1, in2) - override def outlets: immutable.Seq[Outlet[_]] = List(out1, out2) + override def inlets: immutable.Seq[Inlet[?]] = List(in1, in2) + override def outlets: immutable.Seq[Outlet[?]] = List(out1, out2) override def deepCopy() = ShufflePorts(in1.carbonCopy(), in2.carbonCopy(), out1.carbonCopy(), out2.carbonCopy()) } - def apply[In, Out](pipeline: Flow[In, Out, _]): Graph[ShufflePorts[In, Out], NotUsed] = { + def apply[In, Out](pipeline: Flow[In, Out, ?]): Graph[ShufflePorts[In, Out], NotUsed] = { GraphDSL.create() { implicit b => val merge = b.add(Merge[In](2)) val balance = b.add(Balance[Out](2)) 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 d69708333bb..ebd79748d51 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 @@ -41,7 +41,7 @@ class GraphUnzipWithSpec extends StreamSpec(""" type LeftOutput = Int type RightOutput = String - abstract class Fixture(@unused b: GraphDSL.Builder[_]) { + abstract class Fixture(@unused b: GraphDSL.Builder[?]) { def in: Inlet[Int] def left: Outlet[LeftOutput] def right: Outlet[RightOutput] @@ -49,7 +49,7 @@ class GraphUnzipWithSpec extends StreamSpec(""" val f: (Int => (Int, String)) = b => (b + b, s"$b + $b") - def fixture(b: GraphDSL.Builder[_]): Fixture = new Fixture(b) { + def fixture(b: GraphDSL.Builder[?]): Fixture = new Fixture(b) { val unzip = b.add(UnzipWith[Int, Int, String](f)) override def in: Inlet[Int] = unzip.in @@ -232,7 +232,7 @@ class GraphUnzipWithSpec extends StreamSpec(""" ClosedShape }) .run() - val termination = probe.expectMsgType[Future[_]].asInstanceOf[Future[Done]] + val termination = probe.expectMsgType[Future[?]].asInstanceOf[Future[Done]] val killSwitch1 = probe.expectMsgType[UniqueKillSwitch] val killSwitch2 = probe.expectMsgType[UniqueKillSwitch] val boom = TE("Boom") diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipLatestWithSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipLatestWithSpec.scala index 6468d9f43ea..dbadbab7b05 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipLatestWithSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipLatestWithSpec.scala @@ -28,7 +28,7 @@ class GraphZipLatestWithSpec extends TwoStreamsSetup { override type Outputs = Int - override def fixture(b: GraphDSL.Builder[_]): Fixture = new Fixture { + override def fixture(b: GraphDSL.Builder[?]): Fixture = new Fixture { val zip = b.add(ZipWith((_: Int) + (_: Int))) override def left: Inlet[Int] = zip.in0 override def right: Inlet[Int] = zip.in1 diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipNSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipNSpec.scala index 5a106cc57b7..ad62175d2d1 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipNSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipNSpec.scala @@ -26,7 +26,7 @@ class GraphZipNSpec extends TwoStreamsSetup { override type Outputs = immutable.Seq[Int] - override def fixture(b: GraphDSL.Builder[_]): Fixture = new Fixture { + override def fixture(b: GraphDSL.Builder[?]): Fixture = new Fixture { val zipN = b.add(ZipN[Int](2)) override def left: Inlet[Int] = zipN.in(0) diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipSpec.scala index df35cb58c46..3be67e01348 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipSpec.scala @@ -26,7 +26,7 @@ class GraphZipSpec extends TwoStreamsSetup { override type Outputs = (Int, Int) - override def fixture(b: GraphDSL.Builder[_]): Fixture = new Fixture { + override def fixture(b: GraphDSL.Builder[?]): Fixture = new Fixture { val zip = b.add(Zip[Int, Int]()) override def left: Inlet[Int] = zip.in0 diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipWithNSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipWithNSpec.scala index 1341889462d..deacff1f2ba 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipWithNSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipWithNSpec.scala @@ -26,7 +26,7 @@ class GraphZipWithNSpec extends TwoStreamsSetup { override type Outputs = Int - override def fixture(b: GraphDSL.Builder[_]): Fixture = new Fixture { + override def fixture(b: GraphDSL.Builder[?]): Fixture = new Fixture { val zip = b.add(ZipWithN((_: immutable.Seq[Int]).sum)(2)) override def left: Inlet[Int] = zip.in(0) override def right: Inlet[Int] = zip.in(1) diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipWithSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipWithSpec.scala index b57ba6b2d86..b2a9d69856d 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipWithSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipWithSpec.scala @@ -25,7 +25,7 @@ class GraphZipWithSpec extends TwoStreamsSetup { override type Outputs = Int - override def fixture(b: GraphDSL.Builder[_]): Fixture = new Fixture { + override def fixture(b: GraphDSL.Builder[?]): Fixture = new Fixture { val zip = b.add(ZipWith((_: Int) + (_: Int))) override def left: Inlet[Int] = zip.in0 override def right: Inlet[Int] = zip.in1 diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/RestartSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/RestartSpec.scala index 6921d7d9f6c..efa6195f20c 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/RestartSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/RestartSpec.scala @@ -674,7 +674,7 @@ class RestartSpec // helps reuse all the setupFlow code for both methods: withBackoff, and onlyOnFailuresWithBackoff def RestartFlowFactory[In, Out]( onlyOnFailures: Boolean, - settings: RestartSettings): (() => Flow[In, Out, _]) => Flow[In, Out, NotUsed] = + settings: RestartSettings): (() => Flow[In, Out, ?]) => Flow[In, Out, NotUsed] = if (onlyOnFailures) RestartFlow.onFailuresWithBackoff(settings) else RestartFlow.withBackoff(settings) diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/SubstreamSubscriptionTimeoutSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/SubstreamSubscriptionTimeoutSpec.scala index 5775bee84a7..5f604ab63d1 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/SubstreamSubscriptionTimeoutSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/SubstreamSubscriptionTimeoutSpec.scala @@ -35,7 +35,7 @@ class SubstreamSubscriptionTimeoutSpec extends StreamSpec(""" "groupBy and splitwhen" must { "timeout and cancel substream publishers when no-one subscribes to them after some time (time them out)" in { - val subscriber = TestSubscriber.manualProbe[(Int, Source[Int, _])]() + val subscriber = TestSubscriber.manualProbe[(Int, Source[Int, ?])]() val publisherProbe = TestPublisher.probe[Int]() Source.fromPublisher(publisherProbe).groupBy(3, _ % 3).lift(_ % 3).runWith(Sink.fromSubscriber(subscriber)) @@ -76,7 +76,7 @@ class SubstreamSubscriptionTimeoutSpec extends StreamSpec(""" "timeout and stop groupBy parent actor if none of the substreams are actually consumed" in { val publisherProbe = TestPublisher.probe[Int]() - val subscriber = TestSubscriber.manualProbe[(Int, Source[Int, _])]() + val subscriber = TestSubscriber.manualProbe[(Int, Source[Int, ?])]() Source.fromPublisher(publisherProbe).groupBy(2, _ % 2).lift(_ % 2).runWith(Sink.fromSubscriber(subscriber)) val downstreamSubscription = subscriber.expectSubscription() @@ -93,7 +93,7 @@ class SubstreamSubscriptionTimeoutSpec extends StreamSpec(""" "not timeout and cancel substream publishers when they have been subscribed to" in { val publisherProbe = TestPublisher.probe[Int]() - val subscriber = TestSubscriber.manualProbe[(Int, Source[Int, _])]() + val subscriber = TestSubscriber.manualProbe[(Int, Source[Int, ?])]() Source.fromPublisher(publisherProbe).groupBy(2, _ % 2).lift(_ % 2).runWith(Sink.fromSubscriber(subscriber)) val downstreamSubscription = subscriber.expectSubscription() diff --git a/stream-typed-tests/src/test/scala/org/apache/pekko/stream/MapAsyncPartitionedSpec.scala b/stream-typed-tests/src/test/scala/org/apache/pekko/stream/MapAsyncPartitionedSpec.scala index 0b5a01a20ba..37f00799b57 100644 --- a/stream-typed-tests/src/test/scala/org/apache/pekko/stream/MapAsyncPartitionedSpec.scala +++ b/stream-typed-tests/src/test/scala/org/apache/pekko/stream/MapAsyncPartitionedSpec.scala @@ -96,7 +96,7 @@ class MapAsyncPartitionedSpec timeout = 5 seconds, interval = 100 millis) - private implicit val system: ActorSystem[_] = ActorSystem(Behaviors.empty, "test-system") + private implicit val system: ActorSystem[?] = ActorSystem(Behaviors.empty, "test-system") private implicit val ec: ExecutionContext = ExecutionContext.fromExecutor(Executors.newCachedThreadPool()) override protected def afterAll(): Unit = { diff --git a/stream-typed/src/test/scala/docs/org/apache/pekko/stream/typed/ActorSourceSinkExample.scala b/stream-typed/src/test/scala/docs/org/apache/pekko/stream/typed/ActorSourceSinkExample.scala index 5c7cfa26cf5..e54c9f30c31 100644 --- a/stream-typed/src/test/scala/docs/org/apache/pekko/stream/typed/ActorSourceSinkExample.scala +++ b/stream-typed/src/test/scala/docs/org/apache/pekko/stream/typed/ActorSourceSinkExample.scala @@ -21,7 +21,7 @@ import pekko.actor.typed.scaladsl.Behaviors object ActorSourceSinkExample { def compileOnlySourceRef() = { - implicit val system: ActorSystem[_] = ActorSystem(Behaviors.empty, "ActorSourceSinkExample") + implicit val system: ActorSystem[?] = ActorSystem(Behaviors.empty, "ActorSourceSinkExample") // #actor-source-ref import org.apache.pekko @@ -80,7 +80,7 @@ object ActorSourceSinkExample { sender(streamActor, 0) } - private def runStream(ackReceiver: ActorRef[Emitted.type])(implicit system: ActorSystem[_]): ActorRef[Event] = { + private def runStream(ackReceiver: ActorRef[Emitted.type])(implicit system: ActorSystem[?]): ActorRef[Event] = { val source = ActorSource.actorRefWithBackpressure[Event, Emitted.type]( // get demand signalled to this actor receiving Ack @@ -128,7 +128,7 @@ object ActorSourceSinkExample { } def compileOnlyAcotrRef() = { - implicit val system: ActorSystem[_] = ActorSystem(Behaviors.empty, "ActorSourceSinkExample") + implicit val system: ActorSystem[?] = ActorSystem(Behaviors.empty, "ActorSourceSinkExample") def targetActor(): ActorRef[Protocol] = ??? @@ -154,7 +154,7 @@ object ActorSourceSinkExample { } def compileOnlySinkWithBackpressure() = { - implicit val system: ActorSystem[_] = ActorSystem(Behaviors.empty, "ActorSourceSinkExample") + implicit val system: ActorSystem[?] = ActorSystem(Behaviors.empty, "ActorSourceSinkExample") def targetActor(): ActorRef[Protocol] = ??? diff --git a/stream/src/main/scala/com/typesafe/sslconfig/pekko/util/PekkoLoggerBridge.scala b/stream/src/main/scala/com/typesafe/sslconfig/pekko/util/PekkoLoggerBridge.scala index c9b2a6307f4..aff4a7371e7 100644 --- a/stream/src/main/scala/com/typesafe/sslconfig/pekko/util/PekkoLoggerBridge.scala +++ b/stream/src/main/scala/com/typesafe/sslconfig/pekko/util/PekkoLoggerBridge.scala @@ -21,14 +21,14 @@ import pekko.event.Logging._ import com.typesafe.sslconfig.util.{ LoggerFactory, NoDepsLogger } final class PekkoLoggerFactory(system: ActorSystem) extends LoggerFactory { - override def apply(clazz: Class[_]): NoDepsLogger = new PekkoLoggerBridge(system.eventStream, clazz) + override def apply(clazz: Class[?]): NoDepsLogger = new PekkoLoggerBridge(system.eventStream, clazz) override def apply(name: String): NoDepsLogger = new PekkoLoggerBridge(system.eventStream, name, classOf[DummyClassForStringSources]) } -class PekkoLoggerBridge(bus: EventStream, logSource: String, logClass: Class[_]) extends NoDepsLogger { - def this(bus: EventStream, clazz: Class[_]) = this(bus, clazz.getCanonicalName, clazz) +class PekkoLoggerBridge(bus: EventStream, logSource: String, logClass: Class[?]) extends NoDepsLogger { + def this(bus: EventStream, clazz: Class[?]) = this(bus, clazz.getCanonicalName, clazz) override def isDebugEnabled: Boolean = true diff --git a/stream/src/main/scala/org/apache/pekko/stream/FanInShape.scala b/stream/src/main/scala/org/apache/pekko/stream/FanInShape.scala index 511a3e1a354..3fd6d734971 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/FanInShape.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/FanInShape.scala @@ -19,14 +19,14 @@ import scala.collection.immutable object FanInShape { sealed trait Init[O] { def outlet: Outlet[O] - def inlets: immutable.Seq[Inlet[_]] + def inlets: immutable.Seq[Inlet[?]] def name: String } final case class Name[O](override val name: String) extends Init[O] { override def outlet: Outlet[O] = Outlet(s"$name.out") - override def inlets: immutable.Seq[Inlet[_]] = Nil + override def inlets: immutable.Seq[Inlet[?]] = Nil } - final case class Ports[O](override val outlet: Outlet[O], override val inlets: immutable.Seq[Inlet[_]]) + final case class Ports[O](override val outlet: Outlet[O], override val inlets: immutable.Seq[Inlet[?]]) extends Init[O] { override def name: String = "FanIn" } @@ -34,7 +34,7 @@ object FanInShape { abstract class FanInShape[+O] private ( _out: Outlet[O @uncheckedVariance], - _registered: Iterator[Inlet[_]], + _registered: Iterator[Inlet[?]], _name: String) extends Shape { import FanInShape._ @@ -47,12 +47,12 @@ abstract class FanInShape[+O] private ( /** * Not meant for overriding outside of Apache Pekko. */ - override def inlets: immutable.Seq[Inlet[_]] = _inlets + override def inlets: immutable.Seq[Inlet[?]] = _inlets /** * Performance of subclass `UniformFanInShape` relies on `_inlets` being a `Vector`, not a `List`. */ - private var _inlets: Vector[Inlet[_]] = Vector.empty + private var _inlets: Vector[Inlet[?]] = Vector.empty protected def newInlet[T](name: String): Inlet[T] = { val p = if (_registered.hasNext) _registered.next().asInstanceOf[Inlet[T]] else Inlet[T](s"${_name}.$name") _inlets :+= p diff --git a/stream/src/main/scala/org/apache/pekko/stream/FanOutShape.scala b/stream/src/main/scala/org/apache/pekko/stream/FanOutShape.scala index 131ec1db7ff..765387916c6 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/FanOutShape.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/FanOutShape.scala @@ -19,14 +19,14 @@ import scala.collection.immutable object FanOutShape { sealed trait Init[I] { def inlet: Inlet[I] - def outlets: immutable.Seq[Outlet[_]] + def outlets: immutable.Seq[Outlet[?]] def name: String } final case class Name[I](override val name: String) extends Init[I] { override def inlet: Inlet[I] = Inlet(s"$name.in") - override def outlets: immutable.Seq[Outlet[_]] = Nil + override def outlets: immutable.Seq[Outlet[?]] = Nil } - final case class Ports[I](override val inlet: Inlet[I], override val outlets: immutable.Seq[Outlet[_]]) + final case class Ports[I](override val inlet: Inlet[I], override val outlets: immutable.Seq[Outlet[?]]) extends Init[I] { override def name: String = "FanOut" } @@ -34,7 +34,7 @@ object FanOutShape { abstract class FanOutShape[-I] private ( _in: Inlet[I @uncheckedVariance], - _registered: Iterator[Outlet[_]], + _registered: Iterator[Outlet[?]], _name: String) extends Shape { import FanOutShape._ @@ -46,13 +46,13 @@ abstract class FanOutShape[-I] private ( /** * Not meant for overriding outside of Apache Pekko. */ - override def outlets: immutable.Seq[Outlet[_]] = _outlets + override def outlets: immutable.Seq[Outlet[?]] = _outlets final override def inlets: immutable.Seq[Inlet[I @uncheckedVariance]] = in :: Nil /** * Performance of subclass `UniformFanOutShape` relies on `_outlets` being a `Vector`, not a `List`. */ - private var _outlets: Vector[Outlet[_]] = Vector.empty + private var _outlets: Vector[Outlet[?]] = Vector.empty protected def newOutlet[T](name: String): Outlet[T] = { val p = if (_registered.hasNext) _registered.next().asInstanceOf[Outlet[T]] else Outlet[T](s"${_name}.$name") _outlets :+= p diff --git a/stream/src/main/scala/org/apache/pekko/stream/Shape.scala b/stream/src/main/scala/org/apache/pekko/stream/Shape.scala index ea63c08cb1e..12eceee99f5 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/Shape.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/Shape.scala @@ -27,7 +27,7 @@ import pekko.util.ccompat.JavaConverters._ * It is also used in the Java DSL for “classic Inlets” as a work-around * for otherwise unreasonable existential types. */ -sealed abstract class InPort { self: Inlet[_] => +sealed abstract class InPort { self: Inlet[?] => final override def hashCode: Int = super.hashCode final override def equals(that: Any): Boolean = this eq that.asInstanceOf[AnyRef] @@ -44,7 +44,7 @@ sealed abstract class InPort { self: Inlet[_] => /** * INTERNAL API */ - private[stream] def inlet: Inlet[_] = this + private[stream] def inlet: Inlet[?] = this } /** @@ -53,7 +53,7 @@ sealed abstract class InPort { self: Inlet[_] => * It is also used in the Java DSL for “classic Outlets” as a work-around * for otherwise unreasonable existential types. */ -sealed abstract class OutPort { self: Outlet[_] => +sealed abstract class OutPort { self: Outlet[?] => final override def hashCode: Int = super.hashCode final override def equals(that: Any): Boolean = this eq that.asInstanceOf[AnyRef] @@ -70,7 +70,7 @@ sealed abstract class OutPort { self: Outlet[_] => /** * INTERNAL API */ - private[stream] def outlet: Outlet[_] = this + private[stream] def outlet: Outlet[?] = this } /** @@ -166,9 +166,9 @@ final class Outlet[T] private (val s: String) extends OutPort { * `inlets` and `outlets` can be `Vector` or `List` so this method * checks the size of 1 in an optimized way. */ - def hasOnePort(ports: immutable.Seq[_]): Boolean = { + def hasOnePort(ports: immutable.Seq[?]): Boolean = { ports.nonEmpty && (ports match { - case l: List[_] => l.tail.isEmpty // assuming List is most common + case l: List[?] => l.tail.isEmpty // assuming List is most common case _ => ports.size == 1 // e.g. Vector }) } @@ -185,12 +185,12 @@ abstract class Shape { /** * Scala API: get a list of all input ports */ - def inlets: immutable.Seq[Inlet[_]] + def inlets: immutable.Seq[Inlet[?]] /** * Scala API: get a list of all output ports */ - def outlets: immutable.Seq[Outlet[_]] + def outlets: immutable.Seq[Outlet[?]] /** * Create a copy of this Shape object, returning the same type as the @@ -202,12 +202,12 @@ abstract class Shape { /** * Java API: get a list of all input ports */ - def getInlets: java.util.List[Inlet[_]] = inlets.asJava + def getInlets: java.util.List[Inlet[?]] = inlets.asJava /** * Java API: get a list of all output ports */ - def getOutlets: java.util.List[Outlet[_]] = outlets.asJava + def getOutlets: java.util.List[Outlet[?]] = outlets.asJava /** * Compare this to another shape and determine whether the set of ports is the same (ignoring their ordering). @@ -244,15 +244,15 @@ abstract class AbstractShape extends Shape { /** * Provide the list of all input ports of this shape. */ - def allInlets: java.util.List[Inlet[_]] + def allInlets: java.util.List[Inlet[?]] /** * Provide the list of all output ports of this shape. */ - def allOutlets: java.util.List[Outlet[_]] + def allOutlets: java.util.List[Outlet[?]] - final override lazy val inlets: immutable.Seq[Inlet[_]] = allInlets.asScala.toList - final override lazy val outlets: immutable.Seq[Outlet[_]] = allOutlets.asScala.toList + final override lazy val inlets: immutable.Seq[Inlet[?]] = allInlets.asScala.toList + final override lazy val outlets: immutable.Seq[Outlet[?]] = allOutlets.asScala.toList final override def getInlets = allInlets final override def getOutlets = allOutlets @@ -264,8 +264,8 @@ abstract class AbstractShape extends Shape { */ sealed abstract class ClosedShape extends Shape object ClosedShape extends ClosedShape { - override val inlets: immutable.Seq[Inlet[_]] = EmptyImmutableSeq - override val outlets: immutable.Seq[Outlet[_]] = EmptyImmutableSeq + override val inlets: immutable.Seq[Inlet[?]] = EmptyImmutableSeq + override val outlets: immutable.Seq[Outlet[?]] = EmptyImmutableSeq override def deepCopy() = this /** @@ -282,7 +282,7 @@ object ClosedShape extends ClosedShape { * implementation of the [[Graph]] builders and typically replaced by a more * meaningful type of Shape when the building is finished. */ -case class AmorphousShape(inlets: immutable.Seq[Inlet[_]], outlets: immutable.Seq[Outlet[_]]) extends Shape { +case class AmorphousShape(inlets: immutable.Seq[Inlet[?]], outlets: immutable.Seq[Outlet[?]]) extends Shape { override def deepCopy() = AmorphousShape(inlets.map(_.carbonCopy()), outlets.map(_.carbonCopy())) } @@ -291,8 +291,8 @@ case class AmorphousShape(inlets: immutable.Seq[Inlet[_]], outlets: immutable.Se * of data. */ final case class SourceShape[+T](out: Outlet[T @uncheckedVariance]) extends Shape { - override val inlets: immutable.Seq[Inlet[_]] = EmptyImmutableSeq - override val outlets: immutable.Seq[Outlet[_]] = out :: Nil + override val inlets: immutable.Seq[Inlet[?]] = EmptyImmutableSeq + override val outlets: immutable.Seq[Outlet[?]] = out :: Nil override def deepCopy(): SourceShape[T] = SourceShape(out.carbonCopy()) } @@ -309,8 +309,8 @@ object SourceShape { * course). */ final case class FlowShape[-I, +O](in: Inlet[I @uncheckedVariance], out: Outlet[O @uncheckedVariance]) extends Shape { - override val inlets: immutable.Seq[Inlet[_]] = in :: Nil - override val outlets: immutable.Seq[Outlet[_]] = out :: Nil + override val inlets: immutable.Seq[Inlet[?]] = in :: Nil + override val outlets: immutable.Seq[Outlet[?]] = out :: Nil override def deepCopy(): FlowShape[I, O] = FlowShape(in.carbonCopy(), out.carbonCopy()) } @@ -325,8 +325,8 @@ object FlowShape { * A Sink [[Shape]] has exactly one input and no outputs, it models a data sink. */ final case class SinkShape[-T](in: Inlet[T @uncheckedVariance]) extends Shape { - override val inlets: immutable.Seq[Inlet[_]] = in :: Nil - override val outlets: immutable.Seq[Outlet[_]] = EmptyImmutableSeq + override val inlets: immutable.Seq[Inlet[?]] = in :: Nil + override val outlets: immutable.Seq[Outlet[?]] = EmptyImmutableSeq override def deepCopy(): SinkShape[T] = SinkShape(in.carbonCopy()) } @@ -357,8 +357,8 @@ final case class BidiShape[-In1, +Out1, -In2, +Out2]( out2: Outlet[Out2 @uncheckedVariance]) extends Shape { // #implementation-details-elided - override val inlets: immutable.Seq[Inlet[_]] = in1 :: in2 :: Nil - override val outlets: immutable.Seq[Outlet[_]] = out1 :: out2 :: Nil + override val inlets: immutable.Seq[Inlet[?]] = in1 :: in2 :: Nil + override val outlets: immutable.Seq[Outlet[?]] = out1 :: out2 :: Nil /** * Java API for creating from a pair of unidirectional flows. diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/ActorPublisher.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/ActorPublisher.scala index 22cac866abb..94fe4be431d 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/ActorPublisher.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/ActorPublisher.scala @@ -58,11 +58,11 @@ import org.reactivestreams.Subscription // SubscribePending message. The AtomicReference is set to null by the shutdown method, which is // called by the actor from postStop. Pending (unregistered) subscription attempts are denied by // the shutdown method. Subscription attempts after shutdown can be denied immediately. - private val pendingSubscribers = new AtomicReference[immutable.Seq[Subscriber[_ >: T]]](Nil) + private val pendingSubscribers = new AtomicReference[immutable.Seq[Subscriber[? >: T]]](Nil) protected val wakeUpMsg: Any = SubscribePending - override def subscribe(subscriber: Subscriber[_ >: T]): Unit = { + override def subscribe(subscriber: Subscriber[? >: T]): Unit = { requireNonNullSubscriber(subscriber) @tailrec def doSubscribe(): Unit = { val current = pendingSubscribers.get @@ -79,7 +79,7 @@ import org.reactivestreams.Subscription doSubscribe() } - def takePendingSubscribers(): immutable.Seq[Subscriber[_ >: T]] = { + def takePendingSubscribers(): immutable.Seq[Subscriber[? >: T]] = { val pending = pendingSubscribers.getAndSet(Nil) if (pending eq null) Nil else pending.reverse } @@ -94,7 +94,7 @@ import org.reactivestreams.Subscription @volatile private var shutdownReason: Option[Throwable] = None - private def reportSubscribeFailure(subscriber: Subscriber[_ >: T]): Unit = + private def reportSubscribeFailure(subscriber: Subscriber[? >: T]): Unit = try shutdownReason match { case Some(_: SpecViolation) => // ok, not allowed to call onError case Some(e) => @@ -115,7 +115,7 @@ import org.reactivestreams.Subscription */ @InternalApi private[pekko] class ActorSubscription[T]( final val impl: ActorRef, - final val subscriber: Subscriber[_ >: T]) + final val subscriber: Subscriber[? >: T]) extends Subscription { override def request(elements: Long): Unit = impl ! RequestMore(this, elements) override def cancel(): Unit = impl ! Cancel(this) @@ -124,7 +124,7 @@ import org.reactivestreams.Subscription /** * INTERNAL API */ -@InternalApi private[pekko] class ActorSubscriptionWithCursor[T](_impl: ActorRef, _subscriber: Subscriber[_ >: T]) +@InternalApi private[pekko] class ActorSubscriptionWithCursor[T](_impl: ActorRef, _subscriber: Subscriber[? >: T]) extends ActorSubscription[T](_impl, _subscriber) with SubscriptionWithCursor[T] diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/ActorRefBackpressureSource.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/ActorRefBackpressureSource.scala index 29a159433b6..b61dbc04bef 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/ActorRefBackpressureSource.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/ActorRefBackpressureSource.scala @@ -51,7 +51,7 @@ private object ActorRefBackpressureSource { with OutHandler with StageLogging with ActorRefStage { - override protected def logSource: Class[_] = classOf[ActorRefSource[_]] + override protected def logSource: Class[?] = classOf[ActorRefSource[?]] private var isCompleting: Boolean = false private var element: OptionVal[(ActorRef, T)] = OptionVal.none diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/ActorRefSinkStage.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/ActorRefSinkStage.scala index 94852df9732..70d418b5d61 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/ActorRefSinkStage.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/ActorRefSinkStage.scala @@ -39,7 +39,7 @@ final private[pekko] class ActorRefSinkStage[T]( override def createLogic(inheritedAttributes: Attributes): GraphStageLogic = new GraphStageLogic(shape) with InHandler with StageLogging { - override protected def logSource: Class[_] = classOf[ActorRefSinkStage[_]] + override protected def logSource: Class[?] = classOf[ActorRefSinkStage[?]] var completionSignalled = false diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/ActorRefSource.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/ActorRefSource.scala index fb149827ee4..7c75eb69e33 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/ActorRefSource.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/ActorRefSource.scala @@ -50,7 +50,7 @@ private object ActorRefSource { with OutHandler with StageLogging with ActorRefStage { - override protected def logSource: Class[_] = classOf[ActorRefSource[_]] + override protected def logSource: Class[?] = classOf[ActorRefSource[?]] private val buffer: OptionVal[Buffer[T]] = if (maxBuffer != 0) diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/CompletedPublishers.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/CompletedPublishers.scala index 32bda040aa3..56add63eeab 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/CompletedPublishers.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/CompletedPublishers.scala @@ -22,7 +22,7 @@ import org.reactivestreams.{ Publisher, Subscriber, Subscription } */ @InternalApi private[pekko] case object EmptyPublisher extends Publisher[Nothing] { import ReactiveStreamsCompliance._ - override def subscribe(subscriber: Subscriber[_ >: Nothing]): Unit = + override def subscribe(subscriber: Subscriber[? >: Nothing]): Unit = try { requireNonNullSubscriber(subscriber) tryOnSubscribe(subscriber, CancelledSubscription) @@ -41,7 +41,7 @@ import org.reactivestreams.{ Publisher, Subscriber, Subscription } ReactiveStreamsCompliance.requireNonNullElement(t) import ReactiveStreamsCompliance._ - override def subscribe(subscriber: Subscriber[_ >: Nothing]): Unit = + override def subscribe(subscriber: Subscriber[? >: Nothing]): Unit = try { requireNonNullSubscriber(subscriber) tryOnSubscribe(subscriber, CancelledSubscription) @@ -78,7 +78,7 @@ import org.reactivestreams.{ Publisher, Subscriber, Subscription } */ @InternalApi private[pekko] case object RejectAdditionalSubscribers extends Publisher[Nothing] { import ReactiveStreamsCompliance._ - override def subscribe(subscriber: Subscriber[_ >: Nothing]): Unit = + override def subscribe(subscriber: Subscriber[? >: Nothing]): Unit = try rejectAdditionalSubscriber(subscriber, "Publisher") catch { case _: SpecViolation => // nothing we can do 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 90a175a07e8..940689dfdca 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 @@ -336,7 +336,7 @@ import org.reactivestreams.Subscription outputBunch.enqueue(0, a) outputBunch.enqueue(1, b) - case t: pekko.japi.Pair[_, _] => + case t: pekko.japi.Pair[?, ?] => outputBunch.enqueue(0, t.first) outputBunch.enqueue(1, t.second) diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/FanoutProcessor.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/FanoutProcessor.scala index d217f7b873a..5ad698bf4c2 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/FanoutProcessor.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/FanoutProcessor.scala @@ -40,8 +40,8 @@ import org.reactivestreams.Subscriber private var _subscribed = false def subscribed: Boolean = _subscribed - override type S = ActorSubscriptionWithCursor[_ >: Any] - override def createSubscription(subscriber: Subscriber[_ >: Any]): S = { + override type S = ActorSubscriptionWithCursor[? >: Any] + override def createSubscription(subscriber: Subscriber[? >: Any]): S = { _subscribed = true new ActorSubscriptionWithCursor(self, subscriber) } diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/PhasedFusingActorMaterializer.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/PhasedFusingActorMaterializer.scala index 81bd562bc3a..2580657240c 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/PhasedFusingActorMaterializer.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/PhasedFusingActorMaterializer.scala @@ -922,7 +922,7 @@ private final case class SavedIslandData( override def takePublisher(slot: Int, publisher: Publisher[Any], attributes: Attributes): Unit = { subscriberOrVirtualPublisher match { - case v: VirtualPublisher[_] => v.registerPublisher(publisher) + case v: VirtualPublisher[?] => v.registerPublisher(publisher) case s: Subscriber[Any] @unchecked => publisher.subscribe(s) case _ => throw new IllegalStateException() // won't happen, compiler exhaustiveness check pleaser } diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/QueueSource.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/QueueSource.scala index 98827879cf3..d6828375d3f 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/QueueSource.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/QueueSource.scala @@ -55,7 +55,7 @@ import pekko.stream.stage._ val name = inheritedAttributes.nameOrDefault(getClass.toString) val stageLogic = new GraphStageLogic(shape) with OutHandler with SourceQueueWithComplete[T] with StageLogging { - override protected def logSource: Class[_] = classOf[QueueSource[_]] + override protected def logSource: Class[?] = classOf[QueueSource[?]] var buffer: Buffer[T] = _ var pendingOffers: Buffer[Offer[T]] = _ diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/Sinks.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/Sinks.scala index 380b27e2dbd..d929d4727d3 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/Sinks.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/Sinks.scala @@ -245,7 +245,7 @@ import org.reactivestreams.Subscriber /** * INTERNAL API */ -@InternalApi private[pekko] final class SeqStage[T, That](implicit cbf: Factory[T, That with immutable.Iterable[_]]) +@InternalApi private[pekko] final class SeqStage[T, That](implicit cbf: Factory[T, That with immutable.Iterable[?]]) extends GraphStageWithMaterializedValue[SinkShape[T], Future[That]] { val in = Inlet[T]("seq.in") @@ -345,7 +345,7 @@ import org.reactivestreams.Subscriber val e = buffer.dequeue() promise.complete(e) e match { - case Success(_: Some[_]) => // do nothing + case Success(_: Some[?]) => // do nothing case Success(None) => completeStage() case Failure(t) => failStage(t) } diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/StreamLayout.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/StreamLayout.scala index d1b3506f765..46862e02fa4 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/StreamLayout.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/StreamLayout.scala @@ -67,7 +67,7 @@ import org.reactivestreams.Subscription onErrorBuffered: OptionVal[Throwable] = OptionVal.None) extends HasActualSubscriber object Establishing { - def create(s: Subscriber[_]) = Establishing(s.asInstanceOf[Subscriber[Any]]) + def create(s: Subscriber[?]) = Establishing(s.asInstanceOf[Subscriber[Any]]) } } @@ -135,7 +135,7 @@ import org.reactivestreams.Subscription override def toString: String = s"VirtualProcessor(${this.hashCode()})" if (VirtualProcessor.Debug) println(s"created: $this") - override def subscribe(s: Subscriber[_ >: T]): Unit = { + override def subscribe(s: Subscriber[? >: T]): Unit = { @tailrec def rec(sub: Subscriber[Any]): Unit = { get() match { case null => @@ -147,7 +147,7 @@ import org.reactivestreams.Subscription val establishing = Establishing(sub, false) if (compareAndSet(subscription, establishing)) establishSubscription(establishing, subscription) else rec(sub) - case pub: Publisher[_] => + case pub: Publisher[?] => if (VirtualProcessor.Debug) println(s"VirtualPublisher#$hashCode($pub).subscribe.rec($s) -> Inert") if (compareAndSet(pub, Inert)) pub.subscribe(sub) else rec(sub) @@ -172,7 +172,7 @@ import org.reactivestreams.Subscription if (VirtualProcessor.Debug) println(s"VirtualPublisher#$hashCode(null).onSubscribe.rec($obj) -> ${obj.getClass}") if (!compareAndSet(null, obj)) rec(obj) - case subscriber: Subscriber[_] => + case subscriber: Subscriber[?] => obj match { case subscription: Subscription => if (VirtualProcessor.Debug) @@ -180,7 +180,7 @@ import org.reactivestreams.Subscription val establishing = Establishing.create(subscriber) if (compareAndSet(subscriber, establishing)) establishSubscription(establishing, subscription) else rec(obj) - case pub: Publisher[_] => + case pub: Publisher[?] => if (VirtualProcessor.Debug) println(s"VirtualPublisher#$hashCode($subscriber).onSubscribe.rec($obj) -> INert") getAndSet(Inert) match { @@ -274,7 +274,7 @@ import org.reactivestreams.Subscription println(s"VirtualPublisher#$hashCode(Both($s)).onError(${ex.getMessage}) -> ErrorPublisher") set(Inert) tryOnError(s, ex) - case s: Subscriber[_] => // spec violation + case s: Subscriber[?] => // spec violation if (VirtualProcessor.Debug) println(s"VirtualPublisher#$hashCode($s).onError(${ex.getMessage}) -> Inert") getAndSet(Inert) match { case Inert => // nothing to be done @@ -308,7 +308,7 @@ import org.reactivestreams.Subscription if (VirtualProcessor.Debug) println(s"VirtualPublisher#$hashCode($s).onComplete -> Inert") set(Inert) tryOnComplete(s) - case s: Subscriber[_] => // spec violation + case s: Subscriber[?] => // spec violation if (VirtualProcessor.Debug) println(s"VirtualPublisher#$hashCode($s).onComplete -> Inert") set(Inert) EmptyPublisher.subscribe(s) @@ -330,7 +330,7 @@ import org.reactivestreams.Subscription get() match { case x @ (null | _: Subscription) => if (!compareAndSet(x, ErrorPublisher(ex, "failed-VirtualProcessor"))) rec() - case s: Subscriber[_] => + case s: Subscriber[?] => try s.onError(ex) catch { case NonFatal(_) => } finally set(Inert) @@ -359,7 +359,7 @@ import org.reactivestreams.Subscription throw new IllegalStateException("Subscriber threw exception, this is in violation of rule 2:13", e) } - case s: Subscriber[_] => // spec violation + case s: Subscriber[?] => // spec violation if (VirtualProcessor.Debug) println(s"VirtualPublisher#$hashCode($s).onNext($t).rec(): spec violation -> Inert") val ex = new IllegalStateException(noDemand) @@ -368,7 +368,7 @@ import org.reactivestreams.Subscription case _ => ErrorPublisher(ex, "failed-VirtualProcessor").subscribe(s) } throw ex - case Inert | _: Publisher[_] => + case Inert | _: Publisher[?] => if (VirtualProcessor.Debug) println(s"VirtualPublisher#$hashCode(Inert|Publisher).onNext($t).rec(): nop") // nothing to be done case other => @@ -474,7 +474,7 @@ import org.reactivestreams.Subscription import ReactiveStreamsCompliance._ import VirtualProcessor.Inert - override def subscribe(subscriber: Subscriber[_ >: T]): Unit = { + override def subscribe(subscriber: Subscriber[? >: T]): Unit = { requireNonNullSubscriber(subscriber) if (VirtualProcessor.Debug) println(s"$this.subscribe: $subscriber") @tailrec def rec(): Unit = { @@ -482,12 +482,12 @@ import org.reactivestreams.Subscription case null => if (!compareAndSet(null, subscriber)) rec() // retry - case pub: Publisher[_] => + case pub: Publisher[?] => if (compareAndSet(pub, Inert.subscriber)) { pub.asInstanceOf[Publisher[T]].subscribe(subscriber) } else rec() // retry - case _: Subscriber[_] => + case _: Subscriber[?] => rejectAdditionalSubscriber(subscriber, "Sink.asPublisher(fanout = false)") case unexpected => throw new IllegalStateException(s"Unexpected state in VirtualPublisher: $unexpected") @@ -496,7 +496,7 @@ import org.reactivestreams.Subscription rec() // return value is boolean only to make the expressions above compile } - @tailrec final def registerPublisher(pub: Publisher[_]): Unit = { + @tailrec final def registerPublisher(pub: Publisher[?]): Unit = { if (VirtualProcessor.Debug) println(s"$this.registerPublisher: $pub") get() match { case null => @@ -506,7 +506,7 @@ import org.reactivestreams.Subscription set(Inert.subscriber) pub.asInstanceOf[Publisher[r]].subscribe(sub) - case p: Publisher[_] => + case p: Publisher[?] => throw new IllegalStateException( s"internal error, already registered [$p], yet attempted to register 2nd publisher [$pub]!") @@ -520,7 +520,7 @@ import org.reactivestreams.Subscription def onSubscriptionTimeout(am: Materializer, mode: StreamSubscriptionTimeoutTerminationMode): Unit = { import StreamSubscriptionTimeoutTerminationMode._ get() match { - case null | _: Publisher[_] => + case null | _: Publisher[?] => mode match { case CancelTermination => subscribe(new CancellingSubscriber[T]) case WarnTermination => diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/StreamSubscriptionTimeout.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/StreamSubscriptionTimeout.scala index 9998c1e026e..bfd720ff055 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/StreamSubscriptionTimeout.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/StreamSubscriptionTimeout.scala @@ -93,17 +93,17 @@ import org.reactivestreams._ cancellable } - private def cancel(target: Publisher[_], timeout: FiniteDuration): Unit = { + private def cancel(target: Publisher[?], timeout: FiniteDuration): Unit = { val millis = timeout.toMillis target match { - case p: Processor[_, _] => + case p: Processor[?, ?] => log.debug("Cancelling {} Processor's publisher and subscriber sides (after {} ms)", p, millis) handleSubscriptionTimeout( target, new SubscriptionTimeoutException(s"Publisher was not attached to upstream within deadline ($millis) ms") with NoStackTrace) - case p: Publisher[_] => + case p: Publisher[?] => log.debug("Cancelling {} (after: {} ms)", p, millis) handleSubscriptionTimeout( target, @@ -113,7 +113,7 @@ import org.reactivestreams._ } } - private def warn(target: Publisher[_], timeout: FiniteDuration): Unit = { + private def warn(target: Publisher[?], timeout: FiniteDuration): Unit = { log.warning( "Timed out {} detected (after {} ms)! You should investigate if you either cancel or consume all {} instances", target, @@ -125,7 +125,7 @@ import org.reactivestreams._ * Called by the actor when a subscription has timed out. Expects the actual `Publisher` or `Processor` target. */ @nowarn("msg=deprecated") - protected def subscriptionTimedOut(target: Publisher[_]): Unit = subscriptionTimeoutSettings.mode match { + protected def subscriptionTimedOut(target: Publisher[?]): Unit = subscriptionTimeoutSettings.mode match { case NoopTermination => // ignore... case WarnTermination => warn(target, subscriptionTimeoutSettings.timeout) case CancelTermination => cancel(target, subscriptionTimeoutSettings.timeout) @@ -134,7 +134,7 @@ import org.reactivestreams._ /** * Callback that should ensure that the target is canceled with the given cause. */ - protected def handleSubscriptionTimeout(target: Publisher[_], cause: Exception): Unit + protected def handleSubscriptionTimeout(target: Publisher[?], cause: Exception): Unit } /** diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/SubscriberManagement.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/SubscriberManagement.scala index 1a4788d9cca..91c59a6bff6 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/SubscriberManagement.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/SubscriberManagement.scala @@ -49,7 +49,7 @@ private[pekko] object SubscriberManagement { private[pekko] trait SubscriptionWithCursor[T] extends Subscription with ResizableMultiReaderRingBuffer.Cursor { import ReactiveStreamsCompliance._ - def subscriber: Subscriber[_ >: T] + def subscriber: Subscriber[? >: T] def dispatch(element: T): Unit = tryOnNext(subscriber, element) @@ -91,7 +91,7 @@ private[pekko] trait SubscriberManagement[T] extends ResizableMultiReaderRingBuf /** * Use to register a subscriber */ - protected def createSubscription(subscriber: Subscriber[_ >: T]): S + protected def createSubscription(subscriber: Subscriber[? >: T]): S private[this] val buffer = new ResizableMultiReaderRingBuffer[T](initialBufferSize, maxBufferSize, this) @@ -232,7 +232,7 @@ private[pekko] trait SubscriberManagement[T] extends ResizableMultiReaderRingBuf /** * Register a new subscriber. */ - protected def registerSubscriber(subscriber: Subscriber[_ >: T]): Unit = endOfStream match { + protected def registerSubscriber(subscriber: Subscriber[? >: T]): Unit = endOfStream match { case NotReached if subscriptions.exists(_.subscriber == subscriber) => ReactiveStreamsCompliance.rejectDuplicateSubscriber(subscriber) case NotReached => addSubscription(subscriber) @@ -240,7 +240,7 @@ private[pekko] trait SubscriberManagement[T] extends ResizableMultiReaderRingBuf case eos => eos(subscriber) } - private def addSubscription(subscriber: Subscriber[_ >: T]): Unit = { + private def addSubscription(subscriber: Subscriber[? >: T]): Unit = { import ReactiveStreamsCompliance._ val newSubscription = createSubscription(subscriber) subscriptions ::= newSubscription 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 7ff61a2b3a8..0b218a6075f 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 @@ -353,7 +353,7 @@ import pekko.util.unused * Try to find `SingleSource` or wrapped such. This is used as a * performance optimization in FlattenMerge and possibly other places. */ - def getSingleSource[A >: Null](graph: Graph[SourceShape[A], _]): OptionVal[SingleSource[A]] = { + def getSingleSource[A >: Null](graph: Graph[SourceShape[A], ?]): OptionVal[SingleSource[A]] = { graph match { case single: SingleSource[A] @unchecked => OptionVal.Some(single) case _ => @@ -362,7 +362,7 @@ import pekko.util.unused l.pendingBuilder match { case OptionVal.Some(a: AtomicTraversalBuilder) => a.module match { - case m: GraphStageModule[_, _] => + case m: GraphStageModule[?, ?] => m.stage match { case single: SingleSource[A] @unchecked => // It would be != EmptyTraversal if mapMaterializedValue was used and then we can't optimize. @@ -383,9 +383,9 @@ import pekko.util.unused /** * Test if a Graph is an empty Source. */ - def isEmptySource(graph: Graph[SourceShape[_], _]): Boolean = graph match { - case source: scaladsl.Source[_, _] if source eq scaladsl.Source.empty => true - case source: javadsl.Source[_, _] if source eq javadsl.Source.empty() => true + def isEmptySource(graph: Graph[SourceShape[?], ?]): Boolean = graph match { + case source: scaladsl.Source[?, ?] if source eq scaladsl.Source.empty => true + case source: javadsl.Source[?, ?] if source eq javadsl.Source.empty() => true case _ => false } diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/ActorGraphInterpreter.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/ActorGraphInterpreter.scala index ad5f3b325ab..2dbd6ae66f8 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/ActorGraphInterpreter.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/ActorGraphInterpreter.scala @@ -332,7 +332,7 @@ import org.reactivestreams.Subscription protected val wakeUpMsg: Any = SubscribePending(boundary) - override def subscribe(subscriber: Subscriber[_ >: Any]): Unit = { + override def subscribe(subscriber: Subscriber[? >: Any]): Unit = { requireNonNullSubscriber(subscriber) @tailrec def doSubscribe(): Unit = { val current = pendingSubscribers.get diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/GraphStages.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/GraphStages.scala index f3319b0a7e4..456ad70c14a 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/GraphStages.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/GraphStages.scala @@ -176,7 +176,7 @@ import pekko.stream.stage._ private class FlowMonitorImpl[T] extends AtomicReference[Any](Initialized) with FlowMonitor[T] { override def state = get match { - case s: StreamState[_] => s.asInstanceOf[StreamState[T]] + case s: StreamState[?] => s.asInstanceOf[StreamState[T]] case msg => Received(msg.asInstanceOf[T]) } } @@ -194,7 +194,7 @@ import pekko.stream.stage._ def onPush(): Unit = { val msg = grab(in) push(out, msg) - monitor.set(if (msg.isInstanceOf[StreamState[_]]) Received(msg) else msg) + monitor.set(if (msg.isInstanceOf[StreamState[?]]) Received(msg) else msg) } override def onUpstreamFinish(): Unit = { 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 cd8e26de59e..914c9e26774 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 @@ -945,7 +945,7 @@ private[stream] object Collect { override def createLogic(inheritedAttributes: Attributes): GraphStageLogic = new GraphStageLogic(shape) with InHandler with OutHandler with StageLogging { - override protected def logSource: Class[_] = classOf[Buffer[_]] + override protected def logSource: Class[?] = classOf[Buffer[?]] private val buffer: BufferImpl[T] = BufferImpl(size, inheritedAttributes) @@ -1469,7 +1469,7 @@ private[stream] object Collect { override def createLogic(inheritedAttributes: Attributes): GraphStageLogic = new GraphStageLogic(shape) with InHandler with OutHandler with StageLogging { - override protected def logSource: Class[_] = classOf[Watch[_]] + override protected def logSource: Class[?] = classOf[Watch[?]] override def preStart(): Unit = { val self = getStageActor { @@ -1589,7 +1589,7 @@ private[stream] object Collect { final val fromMaterializer = new LogSource[Materializer] { // do not expose private context classes (of OneBoundedInterpreter) - override def getClazz(t: Materializer): Class[_] = classOf[Materializer] + override def getClazz(t: Materializer): Class[?] = classOf[Materializer] override def genString(t: Materializer): String = { try s"$DefaultLoggerName(${t.supervisor.path})" @@ -1709,7 +1709,7 @@ private[stream] object Collect { final val fromMaterializer = new LogSource[Materializer] { // do not expose private context classes (of OneBoundedInterpreter) - override def getClazz(t: Materializer): Class[_] = classOf[Materializer] + override def getClazz(t: Materializer): Class[?] = classOf[Materializer] override def genString(t: Materializer): String = { try s"$DefaultLoggerName(${t.supervisor.path})" diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/StreamOfStreams.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/StreamOfStreams.scala index aba8c7f680c..b6c5b7456b2 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/StreamOfStreams.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/StreamOfStreams.scala @@ -134,7 +134,7 @@ import pekko.util.ccompat.JavaConverters._ src match { case sub: SubSinkInlet[T] @unchecked => sources -= sub - case _: SingleSource[_] => + case _: SingleSource[?] => pendingSingleSources -= 1 case other => throw new IllegalArgumentException(s"Unexpected source type: '${other.getClass}'") } @@ -735,7 +735,7 @@ import pekko.util.ccompat.JavaConverters._ override def createLogic(attr: Attributes) = new GraphStageLogic(shape) with InHandler { // check for previous materialization eagerly so we fail with a more useful stacktrace private[this] val materializationException: OptionVal[IllegalStateException] = - if (status.get.isInstanceOf[AsyncCallback[_]]) + if (status.get.isInstanceOf[AsyncCallback[?]]) OptionVal.Some(createMaterializedTwiceException()) else OptionVal.None @@ -830,7 +830,7 @@ import pekko.util.ccompat.JavaConverters._ override def createLogic(inheritedAttributes: Attributes) = new GraphStageLogic(shape) with OutHandler { // check for previous materialization eagerly so we fail with a more useful stacktrace private[this] val materializationException: OptionVal[IllegalStateException] = - if (status.get.isInstanceOf[AsyncCallback[_]]) + if (status.get.isInstanceOf[AsyncCallback[?]]) OptionVal.Some(createMaterializedTwiceException()) else OptionVal.None @@ -842,7 +842,7 @@ import pekko.util.ccompat.JavaConverters._ case null => if (!status.compareAndSet(null, cb)) setCB(cb) case ActorSubscriberMessage.OnComplete => completeStage() case ActorSubscriberMessage.OnError(ex) => failStage(ex) - case _: AsyncCallback[_] => + case _: AsyncCallback[?] => failStage(materializationException.getOrElse(createMaterializedTwiceException())) case _ => throw new RuntimeException() // won't happen, compiler exhaustiveness check pleaser } diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/io/InputStreamSource.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/io/InputStreamSource.scala index a4f0917a8a8..fa131577882 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/io/InputStreamSource.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/io/InputStreamSource.scala @@ -56,7 +56,7 @@ private[pekko] final class InputStreamSource(factory: () => InputStream, chunkSi private var inputStream: InputStream = _ private def isClosed = mat.isCompleted - override protected def logSource: Class[_] = classOf[InputStreamSource] + override protected def logSource: Class[?] = classOf[InputStreamSource] override def preStart(): Unit = { try { diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/io/OutputStreamGraphStage.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/io/OutputStreamGraphStage.scala index 10ec0d545b7..fc9f2d9a5d9 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/io/OutputStreamGraphStage.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/io/OutputStreamGraphStage.scala @@ -44,7 +44,7 @@ private[pekko] final class OutputStreamGraphStage(factory: () => OutputStream, a var outputStream: OutputStream = _ var bytesWritten: Long = 0L - override protected def logSource: Class[_] = classOf[OutputStreamGraphStage] + override protected def logSource: Class[?] = classOf[OutputStreamGraphStage] override def preStart(): Unit = { try { diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/streamref/SinkRefImpl.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/streamref/SinkRefImpl.scala index 848c1efbe7d..01d02565f85 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/streamref/SinkRefImpl.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/streamref/SinkRefImpl.scala @@ -69,7 +69,7 @@ private[stream] final class SinkRefStageImpl[In] private[pekko] (val initialPart eagerMaterializer: Materializer): (GraphStageLogic, SourceRef[In]) = { val logic = new TimerGraphStageLogic(shape) with StageLogging with ActorRefStage with InHandler { - override protected def logSource: Class[_] = classOf[SinkRefStageImpl[_]] + override protected def logSource: Class[?] = classOf[SinkRefStageImpl[?]] private[this] val streamRefsMaster = StreamRefsMaster(eagerMaterializer.system) diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/streamref/SourceRefImpl.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/streamref/SourceRefImpl.scala index 715e0e90617..7dc60228776 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/streamref/SourceRefImpl.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/streamref/SourceRefImpl.scala @@ -128,7 +128,7 @@ private[stream] final class SourceRefStageImpl[Out](val initialPartnerRef: Optio eagerMaterializer: Materializer): (GraphStageLogic, SinkRef[Out]) = { val logic = new TimerGraphStageLogic(shape) with StageLogging with ActorRefStage with OutHandler { - override protected def logSource: Class[_] = classOf[SourceRefStageImpl[_]] + override protected def logSource: Class[?] = classOf[SourceRefStageImpl[?]] private[this] val streamRefsMaster = StreamRefsMaster(eagerMaterializer.system) 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 e568a1e982c..8900a2ff63b 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 @@ -124,7 +124,7 @@ object Flow { * * See also [[fromSinkAndSourceMat]] when access to materialized values of the parameters is needed. */ - def fromSinkAndSource[I, O](sink: Graph[SinkShape[I], _], source: Graph[SourceShape[O], _]): Flow[I, O, NotUsed] = + def fromSinkAndSource[I, O](sink: Graph[SinkShape[I], ?], source: Graph[SourceShape[O], ?]): Flow[I, O, NotUsed] = new Flow(scaladsl.Flow.fromSinkAndSourceMat(sink, source)(scaladsl.Keep.none)) /** @@ -219,8 +219,8 @@ object Flow { * See also [[fromSinkAndSourceCoupledMat]] when access to materialized values of the parameters is needed. */ def fromSinkAndSourceCoupled[I, O]( - sink: Graph[SinkShape[I], _], - source: Graph[SourceShape[O], _]): Flow[I, O, NotUsed] = + sink: Graph[SinkShape[I], ?], + source: Graph[SourceShape[O], ?]): Flow[I, O, NotUsed] = new Flow(scaladsl.Flow.fromSinkAndSourceCoupled(sink, source)) /** @@ -507,7 +507,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * * See also [[toMat]] when access to materialized values of the parameter is needed. */ - def to(sink: Graph[SinkShape[Out], _]): javadsl.Sink[In, Mat] = + def to(sink: Graph[SinkShape[Out], ?]): javadsl.Sink[In, Mat] = new Sink(delegate.to(sink)) /** @@ -1759,7 +1759,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * * '''Cancels when''' downstream cancels */ - def recover(clazz: Class[_ <: Throwable], supplier: Supplier[Out]): javadsl.Flow[In, Out, Mat] = + def recover(clazz: Class[? <: Throwable], supplier: Supplier[Out]): javadsl.Flow[In, Out, Mat] = recover { case elem if clazz.isInstance(elem) => supplier.get() } @@ -1827,7 +1827,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * * '''Cancels when''' downstream cancels */ - def recoverWith(pf: PartialFunction[Throwable, _ <: Graph[SourceShape[Out], NotUsed]]): javadsl.Flow[In, Out, Mat] = + def recoverWith(pf: PartialFunction[Throwable, ? <: Graph[SourceShape[Out], NotUsed]]): javadsl.Flow[In, Out, Mat] = new Flow(delegate.recoverWith(pf)) /** @@ -1853,7 +1853,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr */ @deprecated("Use recoverWithRetries instead.", "Akka 2.6.6") def recoverWith( - clazz: Class[_ <: Throwable], + clazz: Class[? <: Throwable], supplier: Supplier[Graph[SourceShape[Out], NotUsed]]): javadsl.Flow[In, Out, Mat] = recoverWith({ case elem if clazz.isInstance(elem) => supplier.get() @@ -1917,7 +1917,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr */ def recoverWithRetries( attempts: Int, - clazz: Class[_ <: Throwable], + clazz: Class[? <: Throwable], supplier: Supplier[Graph[SourceShape[Out], NotUsed]]): javadsl.Flow[In, Out, Mat] = recoverWithRetries(attempts, { @@ -1956,7 +1956,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * '''Cancels when''' downstream cancels * @since 1.1.0 */ - def onErrorComplete(clazz: Class[_ <: Throwable]): javadsl.Flow[In, Out, Mat] = + def onErrorComplete(clazz: Class[? <: Throwable]): javadsl.Flow[In, Out, Mat] = onErrorComplete(ex => clazz.isInstance(ex)) /** @@ -1974,7 +1974,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * '''Cancels when''' downstream cancels * @since 1.1.0 */ - def onErrorComplete(predicate: java.util.function.Predicate[_ >: Throwable]): javadsl.Flow[In, Out, Mat] = + def onErrorComplete(predicate: java.util.function.Predicate[? >: Throwable]): javadsl.Flow[In, Out, Mat] = new Flow(delegate.onErrorComplete { case ex: Throwable if predicate.test(ex) => true }) @@ -2566,7 +2566,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * * '''Cancels when''' downstream cancels */ - def flatMapConcat[T, M](f: function.Function[Out, _ <: Graph[SourceShape[T], M]]): Flow[In, T, Mat] = + def flatMapConcat[T, M](f: function.Function[Out, ? <: Graph[SourceShape[T], M]]): Flow[In, T, Mat] = new Flow(delegate.flatMapConcat[T, M](x => f(x))) /** @@ -2582,7 +2582,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * * '''Cancels when''' downstream cancels */ - def flatMapMerge[T, M](breadth: Int, f: function.Function[Out, _ <: Graph[SourceShape[T], M]]): Flow[In, T, Mat] = + def flatMapMerge[T, M](breadth: Int, f: function.Function[Out, ? <: Graph[SourceShape[T], M]]): Flow[In, T, Mat] = new Flow(delegate.flatMapMerge(breadth, o => f(o))) /** @@ -2660,7 +2660,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr */ @varargs @SafeVarargs - def concatAllLazy(those: Graph[SourceShape[Out], _]*): javadsl.Flow[In, Out, Mat] = + def concatAllLazy(those: Graph[SourceShape[Out], ?]*): javadsl.Flow[In, Out, Mat] = new Flow(delegate.concatAllLazy(those: _*)) /** @@ -2850,7 +2850,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * * '''Cancels when''' downstream or Sink cancels */ - def alsoTo(that: Graph[SinkShape[Out], _]): javadsl.Flow[In, Out, Mat] = + def alsoTo(that: Graph[SinkShape[Out], ?]): javadsl.Flow[In, Out, Mat] = new Flow(delegate.alsoTo(that)) /** @@ -2869,7 +2869,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr */ @varargs @SafeVarargs - def alsoToAll(those: Graph[SinkShape[Out], _]*): javadsl.Flow[In, Out, Mat] = + def alsoToAll(those: Graph[SinkShape[Out], ?]*): javadsl.Flow[In, Out, Mat] = new Flow(delegate.alsoToAll(those: _*)) /** @@ -2900,7 +2900,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * * '''Cancels when''' any of the downstreams cancel */ - def divertTo(that: Graph[SinkShape[Out], _], when: function.Predicate[Out]): javadsl.Flow[In, Out, Mat] = + def divertTo(that: Graph[SinkShape[Out], ?], when: function.Predicate[Out]): javadsl.Flow[In, Out, Mat] = new Flow(delegate.divertTo(that, when.test)) /** @@ -2934,7 +2934,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * * '''Cancels when''' downstream cancels */ - def wireTap(that: Graph[SinkShape[Out], _]): javadsl.Flow[In, Out, Mat] = + def wireTap(that: Graph[SinkShape[Out], ?]): javadsl.Flow[In, Out, Mat] = new Flow(delegate.wireTap(that)) /** @@ -2979,7 +2979,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * * '''Cancels when''' downstream cancels */ - def interleave(that: Graph[SourceShape[Out], _], segmentSize: Int): javadsl.Flow[In, Out, Mat] = + def interleave(that: Graph[SourceShape[Out], ?], segmentSize: Int): javadsl.Flow[In, Out, Mat] = interleave(that, segmentSize, eagerClose = false) /** @@ -3002,7 +3002,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * * '''Cancels when''' downstream cancels */ - def interleave(that: Graph[SourceShape[Out], _], segmentSize: Int, eagerClose: Boolean): javadsl.Flow[In, Out, Mat] = + def interleave(that: Graph[SourceShape[Out], ?], segmentSize: Int, eagerClose: Boolean): javadsl.Flow[In, Out, Mat] = new Flow(delegate.interleave(that, segmentSize, eagerClose)) /** @@ -3069,11 +3069,11 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * '''Cancels when''' downstream cancels */ def interleaveAll( - those: java.util.List[_ <: Graph[SourceShape[Out], _ <: Any]], + those: java.util.List[? <: Graph[SourceShape[Out], ? <: Any]], segmentSize: Int, eagerClose: Boolean): javadsl.Flow[In, Out, Mat] = { val seq = if (those != null) Util.immutableSeq(those).collect { - case source: Source[Out @unchecked, _] => source.asScala + case source: Source[Out @unchecked, ?] => source.asScala case other => other } else immutable.Seq() @@ -3092,7 +3092,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * * '''Cancels when''' downstream cancels */ - def merge(that: Graph[SourceShape[Out], _]): javadsl.Flow[In, Out, Mat] = + def merge(that: Graph[SourceShape[Out], ?]): javadsl.Flow[In, Out, Mat] = merge(that, eagerComplete = false) /** @@ -3107,7 +3107,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * * '''Cancels when''' downstream cancels */ - def merge(that: Graph[SourceShape[Out], _], eagerComplete: Boolean): javadsl.Flow[In, Out, Mat] = + def merge(that: Graph[SourceShape[Out], ?], eagerComplete: Boolean): javadsl.Flow[In, Out, Mat] = new Flow(delegate.merge(that, eagerComplete)) /** @@ -3152,10 +3152,10 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * '''Cancels when''' downstream cancels */ def mergeAll( - those: java.util.List[_ <: Graph[SourceShape[Out], _ <: Any]], + those: java.util.List[? <: Graph[SourceShape[Out], ? <: Any]], eagerComplete: Boolean): javadsl.Flow[In, Out, Mat] = { val seq = if (those != null) Util.immutableSeq(those).collect { - case source: Source[Out @unchecked, _] => source.asScala + case source: Source[Out @unchecked, ?] => source.asScala case other => other } else immutable.Seq() @@ -3173,7 +3173,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * '''Completes when''' all upstreams complete (eagerClose=false) or one upstream completes (eagerClose=true) */ def mergeLatest( - that: Graph[SourceShape[Out], _], + that: Graph[SourceShape[Out], ?], eagerComplete: Boolean): javadsl.Flow[In, java.util.List[Out], Mat] = new Flow(delegate.mergeLatest(that, eagerComplete).map(_.asJava)) @@ -3202,7 +3202,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * '''completes''' when all upstreams complete (This behavior is changeable to completing when any upstream completes by setting `eagerComplete=true`.) */ def mergePreferred( - that: Graph[SourceShape[Out], _], + that: Graph[SourceShape[Out], ?], preferred: Boolean, eagerComplete: Boolean): javadsl.Flow[In, Out, Mat] = new Flow(delegate.mergePreferred(that, preferred, eagerComplete)) @@ -3230,7 +3230,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * '''completes''' when both upstreams complete (This behavior is changeable to completing when any upstream completes by setting `eagerComplete=true`.) */ def mergePrioritized( - that: Graph[SourceShape[Out], _], + that: Graph[SourceShape[Out], ?], leftPriority: Int, rightPriority: Int, eagerComplete: Boolean): javadsl.Flow[In, Out, Mat] = @@ -3297,7 +3297,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * * '''Cancels when''' downstream cancels */ - def zip[T](source: Graph[SourceShape[T], _]): javadsl.Flow[In, Out Pair T, Mat] = + def zip[T](source: Graph[SourceShape[T], ?]): javadsl.Flow[In, Out Pair T, Mat] = zipMat(source, Keep.left) /** @@ -3334,7 +3334,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * * '''Cancels when''' downstream cancels */ - def zipAll[U, A >: Out](that: Graph[SourceShape[U], _], thisElem: A, thatElem: U): Flow[In, Pair[A, U], Mat] = + def zipAll[U, A >: Out](that: Graph[SourceShape[U], ?], thisElem: A, thatElem: U): Flow[In, Pair[A, U], Mat] = new Flow(delegate.zipAll(that, thisElem, thatElem).map { case (a, u) => Pair.create(a, u) }) /** @@ -3370,7 +3370,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * * '''Cancels when''' downstream cancels */ - def zipLatest[T](source: Graph[SourceShape[T], _]): javadsl.Flow[In, Out Pair T, Mat] = + def zipLatest[T](source: Graph[SourceShape[T], ?]): javadsl.Flow[In, Out Pair T, Mat] = zipLatestMat(source, Keep.left) /** @@ -3409,7 +3409,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * '''Cancels when''' downstream cancels */ def zipWith[Out2, Out3]( - that: Graph[SourceShape[Out2], _], + that: Graph[SourceShape[Out2], ?], combine: function.Function2[Out, Out2, Out3]): javadsl.Flow[In, Out3, Mat] = new Flow(delegate.zipWith[Out2, Out3](that)(combinerToScala(combine))) @@ -3446,7 +3446,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * '''Cancels when''' downstream cancels */ def zipLatestWith[Out2, Out3]( - that: Graph[SourceShape[Out2], _], + that: Graph[SourceShape[Out2], ?], combine: function.Function2[Out, Out2, Out3]): javadsl.Flow[In, Out3, Mat] = new Flow(delegate.zipLatestWith[Out2, Out3](that)(combinerToScala(combine))) @@ -3468,7 +3468,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * '''Cancels when''' downstream cancels */ def zipLatestWith[Out2, Out3]( - that: Graph[SourceShape[Out2], _], + that: Graph[SourceShape[Out2], ?], eagerComplete: Boolean, combine: function.Function2[Out, Out2, Out3]): javadsl.Flow[In, Out3, Mat] = new Flow(delegate.zipLatestWith[Out2, Out3](that, eagerComplete)(combinerToScala(combine))) diff --git a/stream/src/main/scala/org/apache/pekko/stream/javadsl/FlowWithContext.scala b/stream/src/main/scala/org/apache/pekko/stream/javadsl/FlowWithContext.scala index 2e772e1ffce..678dd115d80 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/FlowWithContext.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/FlowWithContext.scala @@ -238,7 +238,7 @@ final class FlowWithContext[In, CtxIn, Out, CtxOut, +Mat]( * @see [[pekko.stream.javadsl.Flow.mapConcat]] */ def mapConcat[Out2]( - f: function.Function[Out, _ <: java.lang.Iterable[Out2]]): FlowWithContext[In, CtxIn, Out2, CtxOut, Mat] = + f: function.Function[Out, ? <: java.lang.Iterable[Out2]]): FlowWithContext[In, CtxIn, Out2, CtxOut, Mat] = viaScala(_.mapConcat(elem => Util.immutableSeq(f.apply(elem)))) /** 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 9152be5052d..9eb125162cf 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 @@ -648,7 +648,7 @@ object GraphDSL extends GraphCreate { * materialized value and returning the copied Ports that are now to be * connected. */ - def add[S <: Shape](graph: Graph[S, _]): S = delegate.add(graph) + def add[S <: Shape](graph: Graph[S, ?]): S = delegate.add(graph) /** * Returns an [[Outlet]] that gives access to the materialized value of this graph. Once the graph is materialized @@ -679,24 +679,24 @@ object GraphDSL extends GraphCreate { def to[I, O](j: UniformFanOutShape[I, O]): ReverseOps[I] = new ReverseOps(j.in) final class ForwardOps[T](_out: Outlet[T]) { - def toInlet(in: Inlet[_ >: T]): Builder[Mat] = { _out ~> in; self } - def to(dst: SinkShape[_ >: T]): Builder[Mat] = { _out ~> dst; self } - def toFanIn[U](j: UniformFanInShape[_ >: T, U]): Builder[Mat] = { _out ~> j; self } - def toFanOut[U](j: UniformFanOutShape[_ >: T, U]): Builder[Mat] = { _out ~> j; self } - def via[U](f: FlowShape[_ >: T, U]): ForwardOps[U] = from((_out ~> f).outlet) - def viaFanIn[U](j: UniformFanInShape[_ >: T, U]): ForwardOps[U] = from((_out ~> j).outlet) - def viaFanOut[U](j: UniformFanOutShape[_ >: T, U]): ForwardOps[U] = from((_out ~> j).outlet) + def toInlet(in: Inlet[? >: T]): Builder[Mat] = { _out ~> in; self } + def to(dst: SinkShape[? >: T]): Builder[Mat] = { _out ~> dst; self } + def toFanIn[U](j: UniformFanInShape[? >: T, U]): Builder[Mat] = { _out ~> j; self } + def toFanOut[U](j: UniformFanOutShape[? >: T, U]): Builder[Mat] = { _out ~> j; self } + def via[U](f: FlowShape[? >: T, U]): ForwardOps[U] = from((_out ~> f).outlet) + def viaFanIn[U](j: UniformFanInShape[? >: T, U]): ForwardOps[U] = from((_out ~> j).outlet) + def viaFanOut[U](j: UniformFanOutShape[? >: T, U]): ForwardOps[U] = from((_out ~> j).outlet) def out(): Outlet[T] = _out } final class ReverseOps[T](out: Inlet[T]) { - def fromOutlet(dst: Outlet[_ <: T]): Builder[Mat] = { out <~ dst; self } - def from(dst: SourceShape[_ <: T]): Builder[Mat] = { out <~ dst; self } - def fromFanIn[U](j: UniformFanInShape[U, _ <: T]): Builder[Mat] = { out <~ j; self } - def fromFanOut[U](j: UniformFanOutShape[U, _ <: T]): Builder[Mat] = { out <~ j; self } - def via[U](f: FlowShape[U, _ <: T]): ReverseOps[U] = to((out <~ f).inlet) - def viaFanIn[U](j: UniformFanInShape[U, _ <: T]): ReverseOps[U] = to((out <~ j).inlet) - def viaFanOut[U](j: UniformFanOutShape[U, _ <: T]): ReverseOps[U] = to((out <~ j).inlet) + def fromOutlet(dst: Outlet[? <: T]): Builder[Mat] = { out <~ dst; self } + def from(dst: SourceShape[? <: T]): Builder[Mat] = { out <~ dst; self } + def fromFanIn[U](j: UniformFanInShape[U, ? <: T]): Builder[Mat] = { out <~ j; self } + def fromFanOut[U](j: UniformFanOutShape[U, ? <: T]): Builder[Mat] = { out <~ j; self } + def via[U](f: FlowShape[U, ? <: T]): ReverseOps[U] = to((out <~ f).inlet) + def viaFanIn[U](j: UniformFanInShape[U, ? <: T]): ReverseOps[U] = to((out <~ j).inlet) + def viaFanOut[U](j: UniformFanOutShape[U, ? <: T]): ReverseOps[U] = to((out <~ j).inlet) } } } diff --git a/stream/src/main/scala/org/apache/pekko/stream/javadsl/RestartFlow.scala b/stream/src/main/scala/org/apache/pekko/stream/javadsl/RestartFlow.scala index 5ede75abf30..5bebcd63fed 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/RestartFlow.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/RestartFlow.scala @@ -57,7 +57,7 @@ object RestartFlow { minBackoff: FiniteDuration, maxBackoff: FiniteDuration, randomFactor: Double, - flowFactory: Creator[Flow[In, Out, _]]): Flow[In, Out, NotUsed] = { + flowFactory: Creator[Flow[In, Out, ?]]): Flow[In, Out, NotUsed] = { val settings = RestartSettings(minBackoff, maxBackoff, randomFactor) withBackoff(settings, flowFactory) } @@ -91,7 +91,7 @@ object RestartFlow { minBackoff: java.time.Duration, maxBackoff: java.time.Duration, randomFactor: Double, - flowFactory: Creator[Flow[In, Out, _]]): Flow[In, Out, NotUsed] = { + flowFactory: Creator[Flow[In, Out, ?]]): Flow[In, Out, NotUsed] = { val settings = RestartSettings.create(minBackoff, maxBackoff, randomFactor) withBackoff(settings, flowFactory) } @@ -127,7 +127,7 @@ object RestartFlow { maxBackoff: FiniteDuration, randomFactor: Double, maxRestarts: Int, - flowFactory: Creator[Flow[In, Out, _]]): Flow[In, Out, NotUsed] = { + flowFactory: Creator[Flow[In, Out, ?]]): Flow[In, Out, NotUsed] = { val settings = RestartSettings(minBackoff, maxBackoff, randomFactor).withMaxRestarts(maxRestarts, minBackoff) withBackoff(settings, flowFactory) } @@ -164,7 +164,7 @@ object RestartFlow { maxBackoff: java.time.Duration, randomFactor: Double, maxRestarts: Int, - flowFactory: Creator[Flow[In, Out, _]]): Flow[In, Out, NotUsed] = { + flowFactory: Creator[Flow[In, Out, ?]]): Flow[In, Out, NotUsed] = { val settings = RestartSettings.create(minBackoff, maxBackoff, randomFactor).withMaxRestarts(maxRestarts, minBackoff) withBackoff(settings, flowFactory) } @@ -187,7 +187,7 @@ object RestartFlow { * @param settings [[RestartSettings]] defining restart configuration * @param flowFactory A factory for producing the [[Flow]] to wrap. */ - def withBackoff[In, Out](settings: RestartSettings, flowFactory: Creator[Flow[In, Out, _]]): Flow[In, Out, NotUsed] = + def withBackoff[In, Out](settings: RestartSettings, flowFactory: Creator[Flow[In, Out, ?]]): Flow[In, Out, NotUsed] = pekko.stream.scaladsl.RestartFlow .withBackoff(settings) { () => flowFactory.create().asScala @@ -225,7 +225,7 @@ object RestartFlow { maxBackoff: FiniteDuration, randomFactor: Double, maxRestarts: Int, - flowFactory: Creator[Flow[In, Out, _]]): Flow[In, Out, NotUsed] = { + flowFactory: Creator[Flow[In, Out, ?]]): Flow[In, Out, NotUsed] = { val settings = RestartSettings(minBackoff, maxBackoff, randomFactor).withMaxRestarts(maxRestarts, minBackoff) onFailuresWithBackoff(settings, flowFactory) } @@ -262,7 +262,7 @@ object RestartFlow { maxBackoff: java.time.Duration, randomFactor: Double, maxRestarts: Int, - flowFactory: Creator[Flow[In, Out, _]]): Flow[In, Out, NotUsed] = { + flowFactory: Creator[Flow[In, Out, ?]]): Flow[In, Out, NotUsed] = { val settings = RestartSettings.create(minBackoff, maxBackoff, randomFactor).withMaxRestarts(maxRestarts, minBackoff) onFailuresWithBackoff(settings, flowFactory) } @@ -287,7 +287,7 @@ object RestartFlow { */ def onFailuresWithBackoff[In, Out]( settings: RestartSettings, - flowFactory: Creator[Flow[In, Out, _]]): Flow[In, Out, NotUsed] = + flowFactory: Creator[Flow[In, Out, ?]]): Flow[In, Out, NotUsed] = pekko.stream.scaladsl.RestartFlow .onFailuresWithBackoff(settings) { () => flowFactory.create().asScala diff --git a/stream/src/main/scala/org/apache/pekko/stream/javadsl/RestartSink.scala b/stream/src/main/scala/org/apache/pekko/stream/javadsl/RestartSink.scala index b7c3f9c7ce2..a9a857074fd 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/RestartSink.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/RestartSink.scala @@ -58,7 +58,7 @@ object RestartSink { minBackoff: FiniteDuration, maxBackoff: FiniteDuration, randomFactor: Double, - sinkFactory: Creator[Sink[T, _]]): Sink[T, NotUsed] = { + sinkFactory: Creator[Sink[T, ?]]): Sink[T, NotUsed] = { val settings = RestartSettings(minBackoff, maxBackoff, randomFactor) withBackoff(settings, sinkFactory) } @@ -93,7 +93,7 @@ object RestartSink { minBackoff: java.time.Duration, maxBackoff: java.time.Duration, randomFactor: Double, - sinkFactory: Creator[Sink[T, _]]): Sink[T, NotUsed] = { + sinkFactory: Creator[Sink[T, ?]]): Sink[T, NotUsed] = { val settings = RestartSettings.create(minBackoff, maxBackoff, randomFactor) withBackoff(settings, sinkFactory) } @@ -130,7 +130,7 @@ object RestartSink { maxBackoff: FiniteDuration, randomFactor: Double, maxRestarts: Int, - sinkFactory: Creator[Sink[T, _]]): Sink[T, NotUsed] = { + sinkFactory: Creator[Sink[T, ?]]): Sink[T, NotUsed] = { val settings = RestartSettings(minBackoff, maxBackoff, randomFactor).withMaxRestarts(maxRestarts, minBackoff) withBackoff(settings, sinkFactory) } @@ -168,7 +168,7 @@ object RestartSink { maxBackoff: java.time.Duration, randomFactor: Double, maxRestarts: Int, - sinkFactory: Creator[Sink[T, _]]): Sink[T, NotUsed] = { + sinkFactory: Creator[Sink[T, ?]]): Sink[T, NotUsed] = { val settings = RestartSettings.create(minBackoff, maxBackoff, randomFactor).withMaxRestarts(maxRestarts, minBackoff) withBackoff(settings, sinkFactory) } @@ -192,7 +192,7 @@ object RestartSink { * @param settings [[RestartSettings]] defining restart configuration * @param sinkFactory A factory for producing the [[Sink]] to wrap. */ - def withBackoff[T](settings: RestartSettings, sinkFactory: Creator[Sink[T, _]]): Sink[T, NotUsed] = + def withBackoff[T](settings: RestartSettings, sinkFactory: Creator[Sink[T, ?]]): Sink[T, NotUsed] = pekko.stream.scaladsl.RestartSink .withBackoff(settings) { () => sinkFactory.create().asScala diff --git a/stream/src/main/scala/org/apache/pekko/stream/javadsl/RestartSource.scala b/stream/src/main/scala/org/apache/pekko/stream/javadsl/RestartSource.scala index 1c96aa20a92..26bbd792942 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/RestartSource.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/RestartSource.scala @@ -54,7 +54,7 @@ object RestartSource { minBackoff: FiniteDuration, maxBackoff: FiniteDuration, randomFactor: Double, - sourceFactory: Creator[Source[T, _]]): Source[T, NotUsed] = { + sourceFactory: Creator[Source[T, ?]]): Source[T, NotUsed] = { val settings = RestartSettings(minBackoff, maxBackoff, randomFactor) withBackoff(settings, sourceFactory) } @@ -85,7 +85,7 @@ object RestartSource { minBackoff: java.time.Duration, maxBackoff: java.time.Duration, randomFactor: Double, - sourceFactory: Creator[Source[T, _]]): Source[T, NotUsed] = { + sourceFactory: Creator[Source[T, ?]]): Source[T, NotUsed] = { val settings = RestartSettings.create(minBackoff, maxBackoff, randomFactor) withBackoff(settings, sourceFactory) } @@ -119,7 +119,7 @@ object RestartSource { maxBackoff: FiniteDuration, randomFactor: Double, maxRestarts: Int, - sourceFactory: Creator[Source[T, _]]): Source[T, NotUsed] = { + sourceFactory: Creator[Source[T, ?]]): Source[T, NotUsed] = { val settings = RestartSettings(minBackoff, maxBackoff, randomFactor).withMaxRestarts(maxRestarts, minBackoff) withBackoff(settings, sourceFactory) } @@ -154,7 +154,7 @@ object RestartSource { maxBackoff: java.time.Duration, randomFactor: Double, maxRestarts: Int, - sourceFactory: Creator[Source[T, _]]): Source[T, NotUsed] = { + sourceFactory: Creator[Source[T, ?]]): Source[T, NotUsed] = { val settings = RestartSettings.create(minBackoff, maxBackoff, randomFactor).withMaxRestarts(maxRestarts, minBackoff) withBackoff(settings, sourceFactory) } @@ -175,7 +175,7 @@ object RestartSource { * @param settings [[RestartSettings]] defining restart configuration * @param sourceFactory A factory for producing the [[Source]] to wrap. */ - def withBackoff[T](settings: RestartSettings, sourceFactory: Creator[Source[T, _]]): Source[T, NotUsed] = + def withBackoff[T](settings: RestartSettings, sourceFactory: Creator[Source[T, ?]]): Source[T, NotUsed] = pekko.stream.scaladsl.RestartSource .withBackoff(settings) { () => sourceFactory.create().asScala @@ -206,7 +206,7 @@ object RestartSource { minBackoff: FiniteDuration, maxBackoff: FiniteDuration, randomFactor: Double, - sourceFactory: Creator[Source[T, _]]): Source[T, NotUsed] = { + sourceFactory: Creator[Source[T, ?]]): Source[T, NotUsed] = { val settings = RestartSettings(minBackoff, maxBackoff, randomFactor) onFailuresWithBackoff(settings, sourceFactory) } @@ -236,7 +236,7 @@ object RestartSource { minBackoff: java.time.Duration, maxBackoff: java.time.Duration, randomFactor: Double, - sourceFactory: Creator[Source[T, _]]): Source[T, NotUsed] = { + sourceFactory: Creator[Source[T, ?]]): Source[T, NotUsed] = { val settings = RestartSettings.create(minBackoff, maxBackoff, randomFactor) onFailuresWithBackoff(settings, sourceFactory) } @@ -268,7 +268,7 @@ object RestartSource { maxBackoff: FiniteDuration, randomFactor: Double, maxRestarts: Int, - sourceFactory: Creator[Source[T, _]]): Source[T, NotUsed] = { + sourceFactory: Creator[Source[T, ?]]): Source[T, NotUsed] = { val settings = RestartSettings(minBackoff, maxBackoff, randomFactor).withMaxRestarts(maxRestarts, minBackoff) onFailuresWithBackoff(settings, sourceFactory) } @@ -301,7 +301,7 @@ object RestartSource { maxBackoff: java.time.Duration, randomFactor: Double, maxRestarts: Int, - sourceFactory: Creator[Source[T, _]]): Source[T, NotUsed] = { + sourceFactory: Creator[Source[T, ?]]): Source[T, NotUsed] = { val settings = RestartSettings.create(minBackoff, maxBackoff, randomFactor).withMaxRestarts(maxRestarts, minBackoff) onFailuresWithBackoff(settings, sourceFactory) } @@ -320,7 +320,7 @@ object RestartSource { * @param settings [[RestartSettings]] defining restart configuration * @param sourceFactory A factory for producing the [[Source]] to wrap. */ - def onFailuresWithBackoff[T](settings: RestartSettings, sourceFactory: Creator[Source[T, _]]): Source[T, NotUsed] = + def onFailuresWithBackoff[T](settings: RestartSettings, sourceFactory: Creator[Source[T, ?]]): Source[T, NotUsed] = pekko.stream.scaladsl.RestartSource .onFailuresWithBackoff(settings) { () => sourceFactory.create().asScala diff --git a/stream/src/main/scala/org/apache/pekko/stream/javadsl/Sink.scala b/stream/src/main/scala/org/apache/pekko/stream/javadsl/Sink.scala index c71f4338471..b79fb79debd 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/Sink.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/Sink.scala @@ -76,7 +76,7 @@ object Sink { * result container, optionally transformed into a final representation after all input elements have been processed. * The ``Collector`` can also do reduction at the end. Reduction processing is performed sequentially. */ - def collect[U, In](collector: Collector[In, _ <: Any, U]): Sink[In, CompletionStage[U]] = + def collect[U, In](collector: Collector[In, ? <: Any, U]): Sink[In, CompletionStage[U]] = StreamConverters.javaCollector(() => collector) /** @@ -370,9 +370,9 @@ object Sink { * Combine several sinks with fan-out strategy like `Broadcast` or `Balance` and returns `Sink`. */ def combine[T, U]( - output1: Sink[U, _], - output2: Sink[U, _], - rest: java.util.List[Sink[U, _]], + output1: Sink[U, ?], + output2: Sink[U, ?], + rest: java.util.List[Sink[U, ?]], @nowarn @deprecatedName(Symbol("strategy")) fanOutStrategy: function.Function[java.lang.Integer, Graph[UniformFanOutShape[T, U], NotUsed]]) @@ -401,7 +401,7 @@ object Sink { * @since 1.1.0 */ def combine[T, U, M]( - sinks: java.util.List[_ <: Graph[SinkShape[U], M]], + sinks: java.util.List[? <: Graph[SinkShape[U], M]], fanOutStrategy: function.Function[java.lang.Integer, Graph[UniformFanOutShape[T, U], NotUsed]]) : Sink[T, java.util.List[M]] = { val seq = if (sinks != null) Util.immutableSeq(sinks).collect { 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 e7c4aacef4c..f71bce8e7b2 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 @@ -213,7 +213,7 @@ object Source { * stream completes the materialized [[Future]] will be failed with a [[StreamDetachedException]]. */ @deprecated("Use 'Source.futureSource' (potentially together with `Source.fromGraph`) instead", "Akka 2.6.0") - def fromFutureSource[T, M](future: Future[_ <: Graph[SourceShape[T], M]]): javadsl.Source[T, Future[M]] = + def fromFutureSource[T, M](future: Future[? <: Graph[SourceShape[T], M]]): javadsl.Source[T, Future[M]] = new Source(scaladsl.Source.fromFutureSource(future)) /** @@ -224,7 +224,7 @@ object Source { */ @deprecated("Use 'Source.completionStageSource' (potentially together with `Source.fromGraph`) instead", "Akka 2.6.0") def fromSourceCompletionStage[T, M]( - completion: CompletionStage[_ <: Graph[SourceShape[T], M]]): javadsl.Source[T, CompletionStage[M]] = + completion: CompletionStage[? <: Graph[SourceShape[T], M]]): javadsl.Source[T, CompletionStage[M]] = completionStageSource(completion.thenApply(fromGraph[T, M])) /** @@ -653,12 +653,12 @@ object Source { * Combines several sources with fan-in strategy like [[Merge]] or [[Concat]] into a single [[Source]]. */ def combine[T, U]( - first: Source[T, _ <: Any], - second: Source[T, _ <: Any], - rest: java.util.List[Source[T, _ <: Any]], + first: Source[T, ? <: Any], + second: Source[T, ? <: Any], + rest: java.util.List[Source[T, ? <: Any]], @nowarn @deprecatedName(Symbol("strategy")) - fanInStrategy: function.Function[java.lang.Integer, _ <: Graph[UniformFanInShape[T, U], NotUsed]]) + fanInStrategy: function.Function[java.lang.Integer, ? <: Graph[UniformFanInShape[T, U], NotUsed]]) : Source[U, NotUsed] = { val seq = if (rest != null) Util.immutableSeq(rest).map(_.asScala) else immutable.Seq() new Source(scaladsl.Source.combine(first.asScala, second.asScala, seq: _*)(num => fanInStrategy.apply(num))) @@ -672,7 +672,7 @@ object Source { second: Source[T, M2], @nowarn @deprecatedName(Symbol("strategy")) - fanInStrategy: function.Function[java.lang.Integer, _ <: Graph[UniformFanInShape[T, U], NotUsed]], + fanInStrategy: function.Function[java.lang.Integer, ? <: Graph[UniformFanInShape[T, U], NotUsed]], combine: function.Function2[M1, M2, M]): Source[U, M] = { new Source( scaladsl.Source.combineMat(first.asScala, second.asScala)(num => fanInStrategy.apply(num))( @@ -684,7 +684,7 @@ object Source { * @since 1.1.0 */ def combine[T, U, M]( - sources: java.util.List[_ <: Graph[SourceShape[T], M]], + sources: java.util.List[? <: Graph[SourceShape[T], M]], fanInStrategy: function.Function[java.lang.Integer, Graph[UniformFanInShape[T, U], NotUsed]]) : Source[U, java.util.List[M]] = { val seq = if (sources != null) Util.immutableSeq(sources).collect { @@ -699,7 +699,7 @@ object Source { /** * Combine the elements of multiple streams into a stream of lists. */ - def zipN[T](sources: java.util.List[Source[T, _ <: Any]]): Source[java.util.List[T], NotUsed] = { + def zipN[T](sources: java.util.List[Source[T, ? <: Any]]): Source[java.util.List[T], NotUsed] = { val seq = if (sources != null) Util.immutableSeq(sources).map(_.asScala) else immutable.Seq() new Source(scaladsl.Source.zipN(seq).map(_.asJava)) } @@ -709,7 +709,7 @@ object Source { */ def zipWithN[T, O]( zipper: function.Function[java.util.List[T], O], - sources: java.util.List[Source[T, _ <: Any]]): Source[O, NotUsed] = { + sources: java.util.List[Source[T, ? <: Any]]): Source[O, NotUsed] = { val seq = if (sources != null) Util.immutableSeq(sources).map(_.asScala) else immutable.Seq() new Source(scaladsl.Source.zipWithN[T, O](seq => zipper.apply(seq.asJava))(seq)) } @@ -918,7 +918,7 @@ object Source { * '''Cancels when''' downstream cancels */ def mergePrioritizedN[T]( - sourcesAndPriorities: java.util.List[Pair[Source[T, _ <: Any], java.lang.Integer]], + sourcesAndPriorities: java.util.List[Pair[Source[T, ? <: Any], java.lang.Integer]], eagerComplete: Boolean): javadsl.Source[T, NotUsed] = { val seq = if (sourcesAndPriorities != null) @@ -1274,7 +1274,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ */ @varargs @SafeVarargs - def concatAllLazy(those: Graph[SourceShape[Out], _]*): javadsl.Source[Out, Mat] = + def concatAllLazy(those: Graph[SourceShape[Out], ?]*): javadsl.Source[Out, Mat] = new Source(delegate.concatAllLazy(those: _*)) /** @@ -1464,7 +1464,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * * '''Cancels when''' downstream or Sink cancels */ - def alsoTo(that: Graph[SinkShape[Out], _]): javadsl.Source[Out, Mat] = + def alsoTo(that: Graph[SinkShape[Out], ?]): javadsl.Source[Out, Mat] = new Source(delegate.alsoTo(that)) /** @@ -1483,7 +1483,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ */ @varargs @SafeVarargs - def alsoToAll(those: Graph[SinkShape[Out], _]*): javadsl.Source[Out, Mat] = + def alsoToAll(those: Graph[SinkShape[Out], ?]*): javadsl.Source[Out, Mat] = new Source(delegate.alsoToAll(those: _*)) /** @@ -1514,7 +1514,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * * '''Cancels when''' any of the downstreams cancel */ - def divertTo(that: Graph[SinkShape[Out], _], when: function.Predicate[Out]): javadsl.Source[Out, Mat] = + def divertTo(that: Graph[SinkShape[Out], ?], when: function.Predicate[Out]): javadsl.Source[Out, Mat] = new Source(delegate.divertTo(that, when.test)) /** @@ -1548,7 +1548,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * * '''Cancels when''' downstream cancels */ - def wireTap(that: Graph[SinkShape[Out], _]): javadsl.Source[Out, Mat] = + def wireTap(that: Graph[SinkShape[Out], ?]): javadsl.Source[Out, Mat] = new Source(delegate.wireTap(that)) /** @@ -1592,7 +1592,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * * '''Cancels when''' downstream cancels */ - def interleave(that: Graph[SourceShape[Out], _], segmentSize: Int): javadsl.Source[Out, Mat] = + def interleave(that: Graph[SourceShape[Out], ?], segmentSize: Int): javadsl.Source[Out, Mat] = new Source(delegate.interleave(that, segmentSize)) /** @@ -1615,7 +1615,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * * '''Cancels when''' downstream cancels */ - def interleave(that: Graph[SourceShape[Out], _], segmentSize: Int, eagerClose: Boolean): javadsl.Source[Out, Mat] = + def interleave(that: Graph[SourceShape[Out], ?], segmentSize: Int, eagerClose: Boolean): javadsl.Source[Out, Mat] = new Source(delegate.interleave(that, segmentSize, eagerClose)) /** @@ -1682,11 +1682,11 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * '''Cancels when''' downstream cancels */ def interleaveAll( - those: java.util.List[_ <: Graph[SourceShape[Out], _ <: Any]], + those: java.util.List[? <: Graph[SourceShape[Out], ? <: Any]], segmentSize: Int, eagerClose: Boolean): javadsl.Source[Out, Mat] = { val seq = if (those != null) Util.immutableSeq(those).collect { - case source: Source[Out @unchecked, _] => source.asScala + case source: Source[Out @unchecked, ?] => source.asScala case other => other } else immutable.Seq() @@ -1705,7 +1705,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * * '''Cancels when''' downstream cancels */ - def merge(that: Graph[SourceShape[Out], _]): javadsl.Source[Out, Mat] = + def merge(that: Graph[SourceShape[Out], ?]): javadsl.Source[Out, Mat] = new Source(delegate.merge(that)) /** @@ -1720,7 +1720,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * * '''Cancels when''' downstream cancels */ - def merge(that: Graph[SourceShape[Out], _], eagerComplete: Boolean): javadsl.Source[Out, Mat] = + def merge(that: Graph[SourceShape[Out], ?], eagerComplete: Boolean): javadsl.Source[Out, Mat] = new Source(delegate.merge(that, eagerComplete)) /** @@ -1763,10 +1763,10 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * '''Cancels when''' downstream cancels */ def mergeAll( - those: java.util.List[_ <: Graph[SourceShape[Out], _ <: Any]], + those: java.util.List[? <: Graph[SourceShape[Out], ? <: Any]], eagerComplete: Boolean): javadsl.Source[Out, Mat] = { val seq = if (those != null) Util.immutableSeq(those).collect { - case source: Source[Out @unchecked, _] => source.asScala + case source: Source[Out @unchecked, ?] => source.asScala case other => other } else immutable.Seq() @@ -1912,7 +1912,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * * '''Cancels when''' downstream cancels */ - def zip[T](that: Graph[SourceShape[T], _]): javadsl.Source[Out @uncheckedVariance Pair T, Mat] = + def zip[T](that: Graph[SourceShape[T], ?]): javadsl.Source[Out @uncheckedVariance Pair T, Mat] = zipMat(that, Keep.left) /** @@ -1939,7 +1939,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * * '''Cancels when''' downstream cancels */ - def zipAll[U, A >: Out](that: Graph[SourceShape[U], _], thisElem: A, thatElem: U): Source[Pair[A, U], Mat] = + def zipAll[U, A >: Out](that: Graph[SourceShape[U], ?], thisElem: A, thatElem: U): Source[Pair[A, U], Mat] = new Source(delegate.zipAll(that, thisElem, thatElem).map { case (a, u) => Pair.create(a, u) }) /** @@ -1975,7 +1975,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * * '''Cancels when''' downstream cancels */ - def zipLatest[T](that: Graph[SourceShape[T], _]): javadsl.Source[Out @uncheckedVariance Pair T, Mat] = + def zipLatest[T](that: Graph[SourceShape[T], ?]): javadsl.Source[Out @uncheckedVariance Pair T, Mat] = zipLatestMat(that, Keep.left) /** @@ -2004,7 +2004,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * '''Cancels when''' downstream cancels */ def zipWith[Out2, Out3]( - that: Graph[SourceShape[Out2], _], + that: Graph[SourceShape[Out2], ?], combine: function.Function2[Out, Out2, Out3]): javadsl.Source[Out3, Mat] = new Source(delegate.zipWith[Out2, Out3](that)(combinerToScala(combine))) @@ -2041,7 +2041,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * '''Cancels when''' downstream cancels */ def zipLatestWith[Out2, Out3]( - that: Graph[SourceShape[Out2], _], + that: Graph[SourceShape[Out2], ?], combine: function.Function2[Out, Out2, Out3]): javadsl.Source[Out3, Mat] = new Source(delegate.zipLatestWith[Out2, Out3](that)(combinerToScala(combine))) @@ -2063,7 +2063,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * '''Cancels when''' downstream cancels */ def zipLatestWith[Out2, Out3]( - that: Graph[SourceShape[Out2], _], + that: Graph[SourceShape[Out2], ?], eagerComplete: Boolean, combine: function.Function2[Out, Out2, Out3]): javadsl.Source[Out3, Mat] = new Source(delegate.zipLatestWith[Out2, Out3](that, eagerComplete)(combinerToScala(combine))) @@ -2217,7 +2217,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * * '''Cancels when''' downstream cancels */ - def recover(clazz: Class[_ <: Throwable], supplier: Supplier[Out]): javadsl.Source[Out, Mat] = + def recover(clazz: Class[? <: Throwable], supplier: Supplier[Out]): javadsl.Source[Out, Mat] = recover { case elem if clazz.isInstance(elem) => supplier.get() } @@ -2287,7 +2287,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * * @deprecated use `recoverWithRetries` instead */ - def recoverWith(pf: PartialFunction[Throwable, _ <: Graph[SourceShape[Out], NotUsed]]): Source[Out, Mat] = + def recoverWith(pf: PartialFunction[Throwable, ? <: Graph[SourceShape[Out], NotUsed]]): Source[Out, Mat] = new Source(delegate.recoverWith(pf)) /** @@ -2314,7 +2314,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ @deprecated("Use recoverWithRetries instead.", "Akka 2.6.6") @nowarn("msg=deprecated") def recoverWith( - clazz: Class[_ <: Throwable], + clazz: Class[? <: Throwable], supplier: Supplier[Graph[SourceShape[Out], NotUsed]]): Source[Out, Mat] = recoverWith({ case elem if clazz.isInstance(elem) => supplier.get() @@ -2344,7 +2344,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ */ def recoverWithRetries( attempts: Int, - pf: PartialFunction[Throwable, _ <: Graph[SourceShape[Out], NotUsed]]): Source[Out, Mat] = + pf: PartialFunction[Throwable, ? <: Graph[SourceShape[Out], NotUsed]]): Source[Out, Mat] = new Source(delegate.recoverWithRetries(attempts, pf)) /** @@ -2375,7 +2375,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ */ def recoverWithRetries( attempts: Int, - clazz: Class[_ <: Throwable], + clazz: Class[? <: Throwable], supplier: Supplier[Graph[SourceShape[Out], NotUsed]]): Source[Out, Mat] = recoverWithRetries(attempts, { @@ -2414,7 +2414,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * '''Cancels when''' downstream cancels * @since 1.1.0 */ - def onErrorComplete(clazz: Class[_ <: Throwable]): javadsl.Source[Out, Mat] = + def onErrorComplete(clazz: Class[? <: Throwable]): javadsl.Source[Out, Mat] = onErrorComplete(ex => clazz.isInstance(ex)) /** @@ -2432,7 +2432,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * '''Cancels when''' downstream cancels * @since 1.1.0 */ - def onErrorComplete(predicate: java.util.function.Predicate[_ >: Throwable]): javadsl.Source[Out, Mat] = + def onErrorComplete(predicate: java.util.function.Predicate[? >: Throwable]): javadsl.Source[Out, Mat] = new Source(delegate.onErrorComplete { case ex: Throwable if predicate.test(ex) => true }) @@ -2458,7 +2458,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * * '''Cancels when''' downstream cancels */ - def mapConcat[T](f: function.Function[Out, _ <: java.lang.Iterable[T]]): javadsl.Source[T, Mat] = + def mapConcat[T](f: function.Function[Out, ? <: java.lang.Iterable[T]]): javadsl.Source[T, Mat] = new Source(delegate.mapConcat(elem => Util.immutableSeq(f.apply(elem)))) /** @@ -4039,7 +4039,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * * '''Cancels when''' downstream cancels */ - def flatMapConcat[T, M](f: function.Function[Out, _ <: Graph[SourceShape[T], M]]): Source[T, Mat] = + def flatMapConcat[T, M](f: function.Function[Out, ? <: Graph[SourceShape[T], M]]): Source[T, Mat] = new Source(delegate.flatMapConcat[T, M](x => f(x))) /** @@ -4055,7 +4055,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * * '''Cancels when''' downstream cancels */ - def flatMapMerge[T, M](breadth: Int, f: function.Function[Out, _ <: Graph[SourceShape[T], M]]): Source[T, Mat] = + def flatMapMerge[T, M](breadth: Int, f: function.Function[Out, ? <: Graph[SourceShape[T], M]]): Source[T, Mat] = new Source(delegate.flatMapMerge(breadth, o => f(o))) /** diff --git a/stream/src/main/scala/org/apache/pekko/stream/javadsl/SourceWithContext.scala b/stream/src/main/scala/org/apache/pekko/stream/javadsl/SourceWithContext.scala index b825ec0b47f..48889f78bcd 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/SourceWithContext.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/SourceWithContext.scala @@ -232,7 +232,7 @@ final class SourceWithContext[+Out, +Ctx, +Mat](delegate: scaladsl.SourceWithCon * * @see [[pekko.stream.javadsl.Source.mapConcat]] */ - def mapConcat[Out2](f: function.Function[Out, _ <: java.lang.Iterable[Out2]]): SourceWithContext[Out2, Ctx, Mat] = + def mapConcat[Out2](f: function.Function[Out, ? <: java.lang.Iterable[Out2]]): SourceWithContext[Out2, Ctx, Mat] = viaScala(_.mapConcat(elem => Util.immutableSeq(f.apply(elem)))) /** diff --git a/stream/src/main/scala/org/apache/pekko/stream/javadsl/StreamConverters.scala b/stream/src/main/scala/org/apache/pekko/stream/javadsl/StreamConverters.scala index c400ca844d7..6def09a6499 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/StreamConverters.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/StreamConverters.scala @@ -254,7 +254,7 @@ object StreamConverters { * Note that a flow can be materialized multiple times, so the function producing the ``Collector`` must be able * to handle multiple invocations. */ - def javaCollector[T, R](collector: function.Creator[Collector[T, _ <: Any, R]]): Sink[T, CompletionStage[R]] = + def javaCollector[T, R](collector: function.Creator[Collector[T, ? <: Any, R]]): Sink[T, CompletionStage[R]] = new Sink(scaladsl.StreamConverters.javaCollector[T, R](() => collector.create()).toCompletionStage()) /** @@ -268,7 +268,7 @@ object StreamConverters { * to handle multiple invocations. */ def javaCollectorParallelUnordered[T, R](parallelism: Int)( - collector: function.Creator[Collector[T, _ <: Any, R]]): Sink[T, CompletionStage[R]] = + collector: function.Creator[Collector[T, ? <: Any, R]]): Sink[T, CompletionStage[R]] = new Sink( scaladsl.StreamConverters .javaCollectorParallelUnordered[T, R](parallelism)(() => collector.create()) diff --git a/stream/src/main/scala/org/apache/pekko/stream/javadsl/SubFlow.scala b/stream/src/main/scala/org/apache/pekko/stream/javadsl/SubFlow.scala index eee009f8242..00711c843e0 100755 --- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/SubFlow.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/SubFlow.scala @@ -134,7 +134,7 @@ class SubFlow[In, Out, Mat]( * Note that attributes set on the returned graph, including async boundaries are now for the entire graph and not * the `SubFlow`. for example `async` will not have any effect as the returned graph is the entire, closed graph. */ - def to(sink: Graph[SinkShape[Out], _]): Sink[In, Mat] = + def to(sink: Graph[SinkShape[Out], ?]): Sink[In, Mat] = new Sink(delegate.to(sink)) /** @@ -1198,7 +1198,7 @@ class SubFlow[In, Out, Mat]( * '''Cancels when''' downstream cancels * @since 1.1.0 */ - def onErrorComplete(clazz: Class[_ <: Throwable]): SubFlow[In, Out, Mat] = onErrorComplete(ex => clazz.isInstance(ex)) + def onErrorComplete(clazz: Class[? <: Throwable]): SubFlow[In, Out, Mat] = onErrorComplete(ex => clazz.isInstance(ex)) /** * onErrorComplete allows to complete the stream when an upstream error occurs. @@ -1215,7 +1215,7 @@ class SubFlow[In, Out, Mat]( * '''Cancels when''' downstream cancels * @since 1.1.0 */ - def onErrorComplete(predicate: java.util.function.Predicate[_ >: Throwable]): SubFlow[In, Out, Mat] = + def onErrorComplete(predicate: java.util.function.Predicate[? >: Throwable]): SubFlow[In, Out, Mat] = new SubFlow(delegate.onErrorComplete { case ex: Throwable if predicate.test(ex) => true }) @@ -1630,7 +1630,7 @@ class SubFlow[In, Out, Mat]( * * '''Cancels when''' downstream cancels */ - def flatMapConcat[T, M](f: function.Function[Out, _ <: Graph[SourceShape[T], M]]): SubFlow[In, T, Mat] = + def flatMapConcat[T, M](f: function.Function[Out, ? <: Graph[SourceShape[T], M]]): SubFlow[In, T, Mat] = new SubFlow(delegate.flatMapConcat(x => f(x))) /** @@ -1646,7 +1646,7 @@ class SubFlow[In, Out, Mat]( * * '''Cancels when''' downstream cancels */ - def flatMapMerge[T, M](breadth: Int, f: function.Function[Out, _ <: Graph[SourceShape[T], M]]): SubFlow[In, T, Mat] = + def flatMapMerge[T, M](breadth: Int, f: function.Function[Out, ? <: Graph[SourceShape[T], M]]): SubFlow[In, T, Mat] = new SubFlow(delegate.flatMapMerge(breadth, o => f(o))) /** @@ -1724,7 +1724,7 @@ class SubFlow[In, Out, Mat]( */ @varargs @SafeVarargs - def concatAllLazy(those: Graph[SourceShape[Out], _]*): SubFlow[In, Out, Mat] = + def concatAllLazy(those: Graph[SourceShape[Out], ?]*): SubFlow[In, Out, Mat] = new SubFlow(delegate.concatAllLazy(those: _*)) /** @@ -1813,7 +1813,7 @@ class SubFlow[In, Out, Mat]( * * '''Cancels when''' downstream or Sink cancels */ - def alsoTo(that: Graph[SinkShape[Out], _]): SubFlow[In, Out, Mat] = + def alsoTo(that: Graph[SinkShape[Out], ?]): SubFlow[In, Out, Mat] = new SubFlow(delegate.alsoTo(that)) /** @@ -1832,7 +1832,7 @@ class SubFlow[In, Out, Mat]( */ @varargs @SafeVarargs - def alsoToAll(those: Graph[SinkShape[Out], _]*): SubFlow[In, Out, Mat] = + def alsoToAll(those: Graph[SinkShape[Out], ?]*): SubFlow[In, Out, Mat] = new SubFlow(delegate.alsoToAll(those: _*)) /** @@ -1847,7 +1847,7 @@ class SubFlow[In, Out, Mat]( * * '''Cancels when''' any of the downstreams cancel */ - def divertTo(that: Graph[SinkShape[Out], _], when: function.Predicate[Out]): SubFlow[In, Out, Mat] = + def divertTo(that: Graph[SinkShape[Out], ?], when: function.Predicate[Out]): SubFlow[In, Out, Mat] = new SubFlow(delegate.divertTo(that, when.test)) /** @@ -1866,7 +1866,7 @@ class SubFlow[In, Out, Mat]( * * '''Cancels when''' downstream cancels */ - def wireTap(that: Graph[SinkShape[Out], _]): SubFlow[In, Out, Mat] = + def wireTap(that: Graph[SinkShape[Out], ?]): SubFlow[In, Out, Mat] = new SubFlow(delegate.wireTap(that)) /** @@ -1881,7 +1881,7 @@ class SubFlow[In, Out, Mat]( * * '''Cancels when''' downstream cancels */ - def merge(that: Graph[SourceShape[Out], _]): SubFlow[In, Out, Mat] = + def merge(that: Graph[SourceShape[Out], ?]): SubFlow[In, Out, Mat] = new SubFlow(delegate.merge(that)) /** @@ -1897,10 +1897,10 @@ class SubFlow[In, Out, Mat]( * '''Cancels when''' downstream cancels */ def mergeAll( - those: java.util.List[_ <: Graph[SourceShape[Out], _ <: Any]], + those: java.util.List[? <: Graph[SourceShape[Out], ? <: Any]], eagerComplete: Boolean): SubFlow[In, Out, Mat] = { val seq = if (those != null) Util.immutableSeq(those).collect { - case source: Source[Out @unchecked, _] => source.asScala + case source: Source[Out @unchecked, ?] => source.asScala case other => other } else immutable.Seq() @@ -1930,7 +1930,7 @@ class SubFlow[In, Out, Mat]( * * '''Cancels when''' downstream cancels */ - def interleave(that: Graph[SourceShape[Out], _], segmentSize: Int): SubFlow[In, Out, Mat] = + def interleave(that: Graph[SourceShape[Out], ?], segmentSize: Int): SubFlow[In, Out, Mat] = new SubFlow(delegate.interleave(that, segmentSize)) /** @@ -1954,11 +1954,11 @@ class SubFlow[In, Out, Mat]( * '''Cancels when''' downstream cancels */ def interleaveAll( - those: java.util.List[_ <: Graph[SourceShape[Out], _ <: Any]], + those: java.util.List[? <: Graph[SourceShape[Out], ? <: Any]], segmentSize: Int, eagerClose: Boolean): SubFlow[In, Out, Mat] = { val seq = if (those != null) Util.immutableSeq(those).collect { - case source: Source[Out @unchecked, _] => source.asScala + case source: Source[Out @unchecked, ?] => source.asScala case other => other } else immutable.Seq() @@ -2040,7 +2040,7 @@ class SubFlow[In, Out, Mat]( * * '''Cancels when''' downstream cancels */ - def zip[T](source: Graph[SourceShape[T], _]): SubFlow[In, pekko.japi.Pair[Out @uncheckedVariance, T], Mat] = + def zip[T](source: Graph[SourceShape[T], ?]): SubFlow[In, pekko.japi.Pair[Out @uncheckedVariance, T], Mat] = new SubFlow(delegate.zip(source).map { case (o, t) => pekko.japi.Pair.create(o, t) }) /** @@ -2055,7 +2055,7 @@ class SubFlow[In, Out, Mat]( * '''Cancels when''' downstream cancels */ def zipAll[U, A >: Out]( - that: Graph[SourceShape[U], _], + that: Graph[SourceShape[U], ?], thisElem: A, thatElem: U): SubFlow[In, pekko.japi.Pair[A, U], Mat] = new SubFlow(delegate.zipAll(that, thisElem, thatElem).map { case (a, u) => Pair.create(a, u) }) @@ -2072,7 +2072,7 @@ class SubFlow[In, Out, Mat]( * * '''Cancels when''' downstream cancels */ - def zipLatest[T](source: Graph[SourceShape[T], _]): SubFlow[In, pekko.japi.Pair[Out @uncheckedVariance, T], Mat] = + def zipLatest[T](source: Graph[SourceShape[T], ?]): SubFlow[In, pekko.japi.Pair[Out @uncheckedVariance, T], Mat] = new SubFlow(delegate.zipLatest(source).map { case (o, t) => pekko.japi.Pair.create(o, t) }) /** @@ -2088,7 +2088,7 @@ class SubFlow[In, Out, Mat]( * '''Cancels when''' downstream cancels */ def zipWith[Out2, Out3]( - that: Graph[SourceShape[Out2], _], + that: Graph[SourceShape[Out2], ?], combine: function.Function2[Out, Out2, Out3]): SubFlow[In, Out3, Mat] = new SubFlow(delegate.zipWith[Out2, Out3](that)(combinerToScala(combine))) @@ -2106,7 +2106,7 @@ class SubFlow[In, Out, Mat]( * '''Cancels when''' downstream cancels */ def zipLatestWith[Out2, Out3]( - that: Graph[SourceShape[Out2], _], + that: Graph[SourceShape[Out2], ?], combine: function.Function2[Out, Out2, Out3]): SubFlow[In, Out3, Mat] = new SubFlow(delegate.zipLatestWith[Out2, Out3](that)(combinerToScala(combine))) diff --git a/stream/src/main/scala/org/apache/pekko/stream/javadsl/SubSource.scala b/stream/src/main/scala/org/apache/pekko/stream/javadsl/SubSource.scala index eb7e4d38a6f..d45e9544a92 100755 --- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/SubSource.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/SubSource.scala @@ -125,7 +125,7 @@ class SubSource[Out, Mat]( * +----------------------------+ * }}} */ - def to(sink: Graph[SinkShape[Out], _]): RunnableGraph[Mat] = + def to(sink: Graph[SinkShape[Out], ?]): RunnableGraph[Mat] = RunnableGraph.fromGraph(delegate.to(sink)) /** @@ -1178,7 +1178,7 @@ class SubSource[Out, Mat]( * '''Cancels when''' downstream cancels * @since 1.1.0 */ - def onErrorComplete(clazz: Class[_ <: Throwable]): SubSource[Out, Mat] = onErrorComplete(ex => clazz.isInstance(ex)) + def onErrorComplete(clazz: Class[? <: Throwable]): SubSource[Out, Mat] = onErrorComplete(ex => clazz.isInstance(ex)) /** * onErrorComplete allows to complete the stream when an upstream error occurs. @@ -1195,7 +1195,7 @@ class SubSource[Out, Mat]( * '''Cancels when''' downstream cancels * @since 1.1.0 */ - def onErrorComplete(predicate: java.util.function.Predicate[_ >: Throwable]): SubSource[Out, Mat] = + def onErrorComplete(predicate: java.util.function.Predicate[? >: Throwable]): SubSource[Out, Mat] = new SubSource(delegate.onErrorComplete { case ex: Throwable if predicate.test(ex) => true }) @@ -1606,7 +1606,7 @@ class SubSource[Out, Mat]( * * '''Cancels when''' downstream cancels */ - def flatMapConcat[T, M](f: function.Function[Out, _ <: Graph[SourceShape[T], M]]): SubSource[T, Mat] = + def flatMapConcat[T, M](f: function.Function[Out, ? <: Graph[SourceShape[T], M]]): SubSource[T, Mat] = new SubSource(delegate.flatMapConcat(x => f(x))) /** @@ -1622,7 +1622,7 @@ class SubSource[Out, Mat]( * * '''Cancels when''' downstream cancels */ - def flatMapMerge[T, M](breadth: Int, f: function.Function[Out, _ <: Graph[SourceShape[T], M]]): SubSource[T, Mat] = + def flatMapMerge[T, M](breadth: Int, f: function.Function[Out, ? <: Graph[SourceShape[T], M]]): SubSource[T, Mat] = new SubSource(delegate.flatMapMerge(breadth, o => f(o))) /** @@ -1700,7 +1700,7 @@ class SubSource[Out, Mat]( */ @varargs @SafeVarargs - def concatAllLazy(those: Graph[SourceShape[Out], _]*): SubSource[Out, Mat] = + def concatAllLazy(those: Graph[SourceShape[Out], ?]*): SubSource[Out, Mat] = new SubSource(delegate.concatAllLazy(those: _*)) /** @@ -1789,7 +1789,7 @@ class SubSource[Out, Mat]( * * '''Cancels when''' downstream or Sink cancels */ - def alsoTo(that: Graph[SinkShape[Out], _]): SubSource[Out, Mat] = + def alsoTo(that: Graph[SinkShape[Out], ?]): SubSource[Out, Mat] = new SubSource(delegate.alsoTo(that)) /** @@ -1808,7 +1808,7 @@ class SubSource[Out, Mat]( */ @varargs @SafeVarargs - def alsoToAll(those: Graph[SinkShape[Out], _]*): SubSource[Out, Mat] = + def alsoToAll(those: Graph[SinkShape[Out], ?]*): SubSource[Out, Mat] = new SubSource(delegate.alsoToAll(those: _*)) /** @@ -1823,7 +1823,7 @@ class SubSource[Out, Mat]( * * '''Cancels when''' any of the downstreams cancel */ - def divertTo(that: Graph[SinkShape[Out], _], when: function.Predicate[Out]): SubSource[Out, Mat] = + def divertTo(that: Graph[SinkShape[Out], ?], when: function.Predicate[Out]): SubSource[Out, Mat] = new SubSource(delegate.divertTo(that, when.test)) /** @@ -1842,7 +1842,7 @@ class SubSource[Out, Mat]( * * '''Cancels when''' downstream cancels */ - def wireTap(that: Graph[SinkShape[Out], _]): SubSource[Out, Mat] = + def wireTap(that: Graph[SinkShape[Out], ?]): SubSource[Out, Mat] = new SubSource(delegate.wireTap(that)) /** @@ -1857,7 +1857,7 @@ class SubSource[Out, Mat]( * * '''Cancels when''' downstream cancels */ - def merge(that: Graph[SourceShape[Out], _]): SubSource[Out, Mat] = + def merge(that: Graph[SourceShape[Out], ?]): SubSource[Out, Mat] = new SubSource(delegate.merge(that)) /** @@ -1873,10 +1873,10 @@ class SubSource[Out, Mat]( * '''Cancels when''' downstream cancels */ def mergeAll( - those: java.util.List[_ <: Graph[SourceShape[Out], _ <: Any]], + those: java.util.List[? <: Graph[SourceShape[Out], ? <: Any]], eagerComplete: Boolean): SubSource[Out, Mat] = { val seq = if (those != null) Util.immutableSeq(those).collect { - case source: Source[Out @unchecked, _] => source.asScala + case source: Source[Out @unchecked, ?] => source.asScala case other => other } else immutable.Seq() @@ -1907,7 +1907,7 @@ class SubSource[Out, Mat]( * * '''Cancels when''' downstream cancels */ - def interleave(that: Graph[SourceShape[Out], _], segmentSize: Int): SubSource[Out, Mat] = + def interleave(that: Graph[SourceShape[Out], ?], segmentSize: Int): SubSource[Out, Mat] = new SubSource(delegate.interleave(that, segmentSize)) /** @@ -1931,11 +1931,11 @@ class SubSource[Out, Mat]( * '''Cancels when''' downstream cancels */ def interleaveAll( - those: java.util.List[_ <: Graph[SourceShape[Out], _ <: Any]], + those: java.util.List[? <: Graph[SourceShape[Out], ? <: Any]], segmentSize: Int, eagerClose: Boolean): SubSource[Out, Mat] = { val seq = if (those != null) Util.immutableSeq(those).collect { - case source: Source[Out @unchecked, _] => source.asScala + case source: Source[Out @unchecked, ?] => source.asScala case other => other } else immutable.Seq() @@ -2017,7 +2017,7 @@ class SubSource[Out, Mat]( * * '''Cancels when''' downstream cancels */ - def zip[T](source: Graph[SourceShape[T], _]): SubSource[pekko.japi.Pair[Out @uncheckedVariance, T], Mat] = + def zip[T](source: Graph[SourceShape[T], ?]): SubSource[pekko.japi.Pair[Out @uncheckedVariance, T], Mat] = new SubSource(delegate.zip(source).map { case (o, t) => pekko.japi.Pair.create(o, t) }) /** @@ -2032,7 +2032,7 @@ class SubSource[Out, Mat]( * '''Cancels when''' downstream cancels */ def zipAll[U, A >: Out]( - that: Graph[SourceShape[U], _], + that: Graph[SourceShape[U], ?], thisElem: A, thatElem: U): SubSource[pekko.japi.Pair[A, U], Mat] = new SubSource(delegate.zipAll(that, thisElem, thatElem).map { case (a, u) => Pair.create(a, u) }) @@ -2049,7 +2049,7 @@ class SubSource[Out, Mat]( * * '''Cancels when''' downstream cancels */ - def zipLatest[T](source: Graph[SourceShape[T], _]): SubSource[pekko.japi.Pair[Out @uncheckedVariance, T], Mat] = + def zipLatest[T](source: Graph[SourceShape[T], ?]): SubSource[pekko.japi.Pair[Out @uncheckedVariance, T], Mat] = new SubSource(delegate.zipLatest(source).map { case (o, t) => pekko.japi.Pair.create(o, t) }) /** @@ -2065,7 +2065,7 @@ class SubSource[Out, Mat]( * '''Cancels when''' downstream cancels */ def zipWith[Out2, Out3]( - that: Graph[SourceShape[Out2], _], + that: Graph[SourceShape[Out2], ?], combine: function.Function2[Out, Out2, Out3]): SubSource[Out3, Mat] = new SubSource(delegate.zipWith[Out2, Out3](that)(combinerToScala(combine))) @@ -2083,7 +2083,7 @@ class SubSource[Out, Mat]( * '''Cancels when''' downstream cancels */ def zipLatestWith[Out2, Out3]( - that: Graph[SourceShape[Out2], _], + that: Graph[SourceShape[Out2], ?], combine: function.Function2[Out, Out2, Out3]): SubSource[Out3, Mat] = new SubSource(delegate.zipLatestWith[Out2, Out3](that)(combinerToScala(combine))) diff --git a/stream/src/main/scala/org/apache/pekko/stream/javadsl/package.scala b/stream/src/main/scala/org/apache/pekko/stream/javadsl/package.scala index 56baec2ec43..b44a72b1f0f 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/package.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/package.scala @@ -20,7 +20,7 @@ package object javadsl { f match { case x if x eq Keep.left => scaladsl.Keep.left.asInstanceOf[(M1, M2) => M] case x if x eq Keep.right => scaladsl.Keep.right.asInstanceOf[(M1, M2) => M] - case s: Function2[_, _, _] => s.asInstanceOf[(M1, M2) => M] + case s: Function2[?, ?, ?] => s.asInstanceOf[(M1, M2) => M] case other => other.apply _ } } diff --git a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Flow.scala b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Flow.scala index fef56ceda6d..5afdd19c354 100755 --- a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Flow.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Flow.scala @@ -371,7 +371,7 @@ final class Flow[-In, +Out, +Mat]( override def onSubscribe(s: Subscription): Unit = sub.onSubscribe(s) override def onComplete(): Unit = sub.onComplete() override def onNext(t: In): Unit = sub.onNext(t) - override def subscribe(s: Subscriber[_ >: Out]): Unit = pub.subscribe(s) + override def subscribe(s: Subscriber[? >: Out]): Unit = pub.subscribe(s) } } @@ -490,7 +490,7 @@ object Flow { * * See also [[fromSinkAndSourceMat]] when access to materialized values of the parameters is needed. */ - def fromSinkAndSource[I, O](sink: Graph[SinkShape[I], _], source: Graph[SourceShape[O], _]): Flow[I, O, NotUsed] = + def fromSinkAndSource[I, O](sink: Graph[SinkShape[I], ?], source: Graph[SourceShape[O], ?]): Flow[I, O, NotUsed] = fromSinkAndSourceMat(sink, source)(Keep.none) /** @@ -585,8 +585,8 @@ object Flow { * See also [[fromSinkAndSourceCoupledMat]] when access to materialized values of the parameters is needed. */ def fromSinkAndSourceCoupled[I, O]( - sink: Graph[SinkShape[I], _], - source: Graph[SourceShape[O], _]): Flow[I, O, NotUsed] = + sink: Graph[SinkShape[I], ?], + source: Graph[SourceShape[O], ?]): Flow[I, O, NotUsed] = fromSinkAndSourceCoupledMat(sink, source)(Keep.none) /** @@ -2931,7 +2931,7 @@ trait FlowOps[+Out, +Mat] { * * '''Cancels when''' downstream cancels */ - def zip[U](that: Graph[SourceShape[U], _]): Repr[(Out, U)] = via(zipGraph(that)) + def zip[U](that: Graph[SourceShape[U], ?]): Repr[(Out, U)] = via(zipGraph(that)) /** * Combine the elements of current flow and the given [[Source]] into a stream of tuples. @@ -2944,7 +2944,7 @@ trait FlowOps[+Out, +Mat] { * * '''Cancels when''' downstream cancels */ - def zipAll[U, A >: Out](that: Graph[SourceShape[U], _], thisElem: A, thatElem: U): Repr[(A, U)] = { + def zipAll[U, A >: Out](that: Graph[SourceShape[U], ?], thisElem: A, thatElem: U): Repr[(A, U)] = { via(zipAllFlow(that, thisElem, thatElem)) } @@ -2993,7 +2993,7 @@ trait FlowOps[+Out, +Mat] { * * '''Cancels when''' downstream cancels */ - def zipLatest[U](that: Graph[SourceShape[U], _]): Repr[(Out, U)] = via(zipLatestGraph(that)) + def zipLatest[U](that: Graph[SourceShape[U], ?]): Repr[(Out, U)] = via(zipLatestGraph(that)) protected def zipLatestGraph[U, M]( that: Graph[SourceShape[U], M]): Graph[FlowShape[Out @uncheckedVariance, (Out, U)], M] = @@ -3015,7 +3015,7 @@ trait FlowOps[+Out, +Mat] { * * '''Cancels when''' downstream cancels */ - def zipWith[Out2, Out3](that: Graph[SourceShape[Out2], _])(combine: (Out, Out2) => Out3): Repr[Out3] = + def zipWith[Out2, Out3](that: Graph[SourceShape[Out2], ?])(combine: (Out, Out2) => Out3): Repr[Out3] = via(zipWithGraph(that)(combine)) protected def zipWithGraph[Out2, Out3, M](that: Graph[SourceShape[Out2], M])( @@ -3043,7 +3043,7 @@ trait FlowOps[+Out, +Mat] { * * '''Cancels when''' downstream cancels */ - def zipLatestWith[Out2, Out3](that: Graph[SourceShape[Out2], _])(combine: (Out, Out2) => Out3): Repr[Out3] = + def zipLatestWith[Out2, Out3](that: Graph[SourceShape[Out2], ?])(combine: (Out, Out2) => Out3): Repr[Out3] = zipLatestWith(that, eagerComplete = true)(combine) /** @@ -3063,7 +3063,7 @@ trait FlowOps[+Out, +Mat] { * * '''Cancels when''' downstream cancels */ - def zipLatestWith[Out2, Out3](that: Graph[SourceShape[Out2], _], eagerComplete: Boolean)( + def zipLatestWith[Out2, Out3](that: Graph[SourceShape[Out2], ?], eagerComplete: Boolean)( combine: (Out, Out2) => Out3): Repr[Out3] = via(zipLatestWithGraph(that, eagerComplete)(combine)) @@ -3119,7 +3119,7 @@ trait FlowOps[+Out, +Mat] { * * '''Cancels when''' downstream cancels */ - def interleave[U >: Out](that: Graph[SourceShape[U], _], segmentSize: Int): Repr[U] = + def interleave[U >: Out](that: Graph[SourceShape[U], ?], segmentSize: Int): Repr[U] = interleave(that, segmentSize, eagerClose = false) /** @@ -3142,7 +3142,7 @@ trait FlowOps[+Out, +Mat] { * * '''Cancels when''' downstream cancels */ - def interleave[U >: Out](that: Graph[SourceShape[U], _], segmentSize: Int, eagerClose: Boolean): Repr[U] = + def interleave[U >: Out](that: Graph[SourceShape[U], ?], segmentSize: Int, eagerClose: Boolean): Repr[U] = via(interleaveGraph(that, segmentSize, eagerClose)) protected def interleaveGraph[U >: Out, M]( @@ -3176,7 +3176,7 @@ trait FlowOps[+Out, +Mat] { * '''Cancels when''' downstream cancels */ def interleaveAll[U >: Out]( - those: immutable.Seq[Graph[SourceShape[U], _]], + those: immutable.Seq[Graph[SourceShape[U], ?]], segmentSize: Int, eagerClose: Boolean): Repr[U] = those match { case those if those.isEmpty => this.asInstanceOf[Repr[U]] @@ -3226,7 +3226,7 @@ trait FlowOps[+Out, +Mat] { * * '''Cancels when''' downstream cancels */ - def mergeAll[U >: Out](those: immutable.Seq[Graph[SourceShape[U], _]], eagerComplete: Boolean): Repr[U] = + def mergeAll[U >: Out](those: immutable.Seq[Graph[SourceShape[U], ?]], eagerComplete: Boolean): Repr[U] = those match { case those if those.isEmpty => this.asInstanceOf[Repr[U]] case _ => @@ -3427,7 +3427,7 @@ trait FlowOps[+Out, +Mat] { * * '''Cancels when''' downstream cancels */ - def concatAllLazy[U >: Out](those: Graph[SourceShape[U], _]*): Repr[U] = + def concatAllLazy[U >: Out](those: Graph[SourceShape[U], ?]*): Repr[U] = internalConcatAll(those.toArray, detached = false) private def internalConcat[U >: Out, Mat2](that: Graph[SourceShape[U], Mat2], detached: Boolean): Repr[U] = @@ -3441,7 +3441,7 @@ trait FlowOps[+Out, +Mat] { } } - private def internalConcatAll[U >: Out](those: Array[Graph[SourceShape[U], _]], detached: Boolean): Repr[U] = + private def internalConcatAll[U >: Out](those: Array[Graph[SourceShape[U], ?]], detached: Boolean): Repr[U] = those match { case those if those.isEmpty => this.asInstanceOf[Repr[U]] case those if those.length == 1 => internalConcat(those.head, detached) @@ -3591,7 +3591,7 @@ trait FlowOps[+Out, +Mat] { * * '''Cancels when''' downstream or Sink cancels */ - def alsoTo(that: Graph[SinkShape[Out], _]): Repr[Out] = via(alsoToGraph(that)) + def alsoTo(that: Graph[SinkShape[Out], ?]): Repr[Out] = via(alsoToGraph(that)) protected def alsoToGraph[M](that: Graph[SinkShape[Out], M]): Graph[FlowShape[Out @uncheckedVariance, Out], M] = GraphDSL.createGraph(that) { implicit b => r => @@ -3615,7 +3615,7 @@ trait FlowOps[+Out, +Mat] { * * '''Cancels when''' downstream or any of the [[Sink]]s cancels */ - def alsoToAll(those: Graph[SinkShape[Out], _]*): Repr[Out] = those match { + def alsoToAll(those: Graph[SinkShape[Out], ?]*): Repr[Out] = those match { case those if those.isEmpty => this.asInstanceOf[Repr[Out]] case _ => via(GraphDSL.create() { implicit b => @@ -3639,7 +3639,7 @@ trait FlowOps[+Out, +Mat] { * * '''Cancels when''' any of the downstreams cancel */ - def divertTo(that: Graph[SinkShape[Out], _], when: Out => Boolean): Repr[Out] = via(divertToGraph(that, when)) + def divertTo(that: Graph[SinkShape[Out], ?], when: Out => Boolean): Repr[Out] = via(divertToGraph(that, when)) protected def divertToGraph[M]( that: Graph[SinkShape[Out], M], @@ -3667,7 +3667,7 @@ trait FlowOps[+Out, +Mat] { * * '''Cancels when''' downstream cancels */ - def wireTap(that: Graph[SinkShape[Out], _]): Repr[Out] = via(wireTapGraph(that)) + def wireTap(that: Graph[SinkShape[Out], ?]): Repr[Out] = via(wireTapGraph(that)) protected def wireTapGraph[M](that: Graph[SinkShape[Out], M]): Graph[FlowShape[Out @uncheckedVariance, Out], M] = GraphDSL.createGraph(that) { implicit b => r => @@ -3740,7 +3740,7 @@ trait FlowOpsMat[+Out, +Mat] extends FlowOps[Out, Mat] { type Closed = FlowOpsMat.this.ClosedMat[M @uncheckedVariance] type ClosedMat[+MM] = FlowOpsMat.this.ClosedMat[MM] } - type ClosedMat[+M] <: Graph[_, M] + type ClosedMat[+M] <: Graph[?, M] /** * Transform this [[Flow]] by appending the given processing steps. diff --git a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Graph.scala b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Graph.scala index f5a5b92bfd6..bf062e8990d 100755 --- a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Graph.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Graph.scala @@ -1598,8 +1598,8 @@ object GraphDSL extends GraphApply { } class Builder[+M] private[stream] () { - private val unwiredIns = new mutable.HashSet[Inlet[_]]() - private val unwiredOuts = new mutable.HashSet[Outlet[_]]() + private val unwiredIns = new mutable.HashSet[Inlet[?]]() + private val unwiredOuts = new mutable.HashSet[Outlet[?]]() private var traversalBuilderInProgress: TraversalBuilder = TraversalBuilder.empty() @@ -1625,7 +1625,7 @@ object GraphDSL extends GraphApply { * materialized value and returning the copied Ports that are now to be * connected. */ - def add[S <: Shape](graph: Graph[S, _]): S = { + def add[S <: Shape](graph: Graph[S, ?]): S = { val newShape = graph.shape.deepCopy() traversalBuilderInProgress = traversalBuilderInProgress.add(graph.traversalBuilder, newShape, Keep.left) @@ -1641,7 +1641,7 @@ object GraphDSL extends GraphApply { * This is only used by the materialization-importing apply methods of Source, * Flow, Sink and Graph. */ - private[stream] def add[S <: Shape, A](graph: Graph[S, _], transform: (A) => Any): S = { + private[stream] def add[S <: Shape, A](graph: Graph[S, ?], transform: (A) => Any): S = { val newShape = graph.shape.deepCopy() traversalBuilderInProgress = traversalBuilderInProgress.add(graph.traversalBuilder.transformMat(transform), newShape, Keep.right) @@ -1658,7 +1658,7 @@ object GraphDSL extends GraphApply { * This is only used by the materialization-importing apply methods of Source, * Flow, Sink and Graph. */ - private[stream] def add[S <: Shape, A, B](graph: Graph[S, _], combine: (A, B) => Any): S = { + private[stream] def add[S <: Shape, A, B](graph: Graph[S, ?], combine: (A, B) => Any): S = { val newShape = graph.shape.deepCopy() traversalBuilderInProgress = traversalBuilderInProgress.add(graph.traversalBuilder, newShape, combine) @@ -1725,7 +1725,7 @@ object GraphDSL extends GraphApply { object Implicits { @tailrec - private[stream] def findOut[I, O](b: Builder[_], junction: UniformFanOutShape[I, O], n: Int): Outlet[O] = { + private[stream] def findOut[I, O](b: Builder[?], junction: UniformFanOutShape[I, O], n: Int): Outlet[O] = { if (n == junction.outlets.length) throw new IllegalArgumentException(s"no more outlets free on $junction") else if (!b.traversalBuilder.isUnwired(junction.out(n))) findOut(b, junction, n + 1) @@ -1733,7 +1733,7 @@ object GraphDSL extends GraphApply { } @tailrec - private[stream] def findIn[I, O](b: Builder[_], junction: UniformFanInShape[I, O], n: Int): Inlet[I] = { + private[stream] def findIn[I, O](b: Builder[?], junction: UniformFanInShape[I, O], n: Int): Inlet[I] = { if (n == junction.inlets.length) throw new IllegalArgumentException(s"no more inlets free on $junction") else if (!b.traversalBuilder.isUnwired(junction.in(n))) findIn(b, junction, n + 1) @@ -1741,18 +1741,18 @@ object GraphDSL extends GraphApply { } sealed trait CombinerBase[+T] extends Any { - def importAndGetPort(b: Builder[_]): Outlet[T @uncheckedVariance] + def importAndGetPort(b: Builder[?]): Outlet[T @uncheckedVariance] - def ~>[U >: T](to: Inlet[U])(implicit b: Builder[_]): Unit = + def ~>[U >: T](to: Inlet[U])(implicit b: Builder[?]): Unit = b.addEdge(importAndGetPort(b), to) - def ~>[Out](via: Graph[FlowShape[T, Out], Any])(implicit b: Builder[_]): PortOps[Out] = { + def ~>[Out](via: Graph[FlowShape[T, Out], Any])(implicit b: Builder[?]): PortOps[Out] = { val s = b.add(via) b.addEdge(importAndGetPort(b), s.in) s.out } - def ~>[Out](junction: UniformFanInShape[T, Out])(implicit b: Builder[_]): PortOps[Out] = { + def ~>[Out](junction: UniformFanInShape[T, Out])(implicit b: Builder[?]): PortOps[Out] = { def bind(n: Int): Unit = { if (n == junction.inlets.length) throw new IllegalArgumentException(s"no more inlets free on $junction") @@ -1763,7 +1763,7 @@ object GraphDSL extends GraphApply { junction.out } - def ~>[Out](junction: UniformFanOutShape[T, Out])(implicit b: Builder[_]): PortOps[Out] = { + def ~>[Out](junction: UniformFanOutShape[T, Out])(implicit b: Builder[?]): PortOps[Out] = { b.addEdge(importAndGetPort(b), junction.in) try findOut(b, junction, 0) catch { @@ -1771,31 +1771,31 @@ object GraphDSL extends GraphApply { } } - def ~>[Out](flow: FlowShape[T, Out])(implicit b: Builder[_]): PortOps[Out] = { + def ~>[Out](flow: FlowShape[T, Out])(implicit b: Builder[?]): PortOps[Out] = { b.addEdge(importAndGetPort(b), flow.in) flow.out } - def ~>(to: Graph[SinkShape[T], _])(implicit b: Builder[_]): Unit = + def ~>(to: Graph[SinkShape[T], ?])(implicit b: Builder[?]): Unit = b.addEdge(importAndGetPort(b), b.add(to).in) - def ~>(to: SinkShape[T])(implicit b: Builder[_]): Unit = + def ~>(to: SinkShape[T])(implicit b: Builder[?]): Unit = b.addEdge(importAndGetPort(b), to.in) } sealed trait ReverseCombinerBase[T] extends Any { - def importAndGetPortReverse(b: Builder[_]): Inlet[T] + def importAndGetPortReverse(b: Builder[?]): Inlet[T] - def <~[U <: T](from: Outlet[U])(implicit b: Builder[_]): Unit = + def <~[U <: T](from: Outlet[U])(implicit b: Builder[?]): Unit = b.addEdge(from, importAndGetPortReverse(b)) - def <~[In](via: Graph[FlowShape[In, T], _])(implicit b: Builder[_]): ReversePortOps[In] = { + def <~[In](via: Graph[FlowShape[In, T], ?])(implicit b: Builder[?]): ReversePortOps[In] = { val s = b.add(via) b.addEdge(s.out, importAndGetPortReverse(b)) s.in } - def <~[In](junction: UniformFanOutShape[In, T])(implicit b: Builder[_]): ReversePortOps[In] = { + def <~[In](junction: UniformFanOutShape[In, T])(implicit b: Builder[?]): ReversePortOps[In] = { def bind(n: Int): Unit = { if (n == junction.outlets.length) throw new IllegalArgumentException(s"no more outlets free on $junction") @@ -1806,7 +1806,7 @@ object GraphDSL extends GraphApply { junction.in } - def <~[In](junction: UniformFanInShape[In, T])(implicit b: Builder[_]): ReversePortOps[In] = { + def <~[In](junction: UniformFanInShape[In, T])(implicit b: Builder[?]): ReversePortOps[In] = { b.addEdge(junction.out, importAndGetPortReverse(b)) try findIn(b, junction, 0) catch { @@ -1814,15 +1814,15 @@ object GraphDSL extends GraphApply { } } - def <~[In](flow: FlowShape[In, T])(implicit b: Builder[_]): ReversePortOps[In] = { + def <~[In](flow: FlowShape[In, T])(implicit b: Builder[?]): ReversePortOps[In] = { b.addEdge(flow.out, importAndGetPortReverse(b)) flow.in } - def <~(from: Graph[SourceShape[T], _])(implicit b: Builder[_]): Unit = + def <~(from: Graph[SourceShape[T], ?])(implicit b: Builder[?]): Unit = b.addEdge(b.add(from).out, importAndGetPortReverse(b)) - def <~(from: SourceShape[T])(implicit b: Builder[_]): Unit = + def <~(from: SourceShape[T])(implicit b: Builder[?]): Unit = b.addEdge(from.out, importAndGetPortReverse(b)) } @@ -1834,7 +1834,7 @@ object GraphDSL extends GraphApply { def outlet: Outlet[Out @uncheckedVariance] } - private class PortOpsImpl[+Out](override val outlet: Outlet[Out @uncheckedVariance], b: Builder[_]) + private class PortOpsImpl[+Out](override val outlet: Outlet[Out @uncheckedVariance], b: Builder[?]) extends PortOps[Out] { override def withAttributes(attr: Attributes): Repr[Out] = throw settingAttrNotSupported @@ -1845,7 +1845,7 @@ object GraphDSL extends GraphApply { private def settingAttrNotSupported = new UnsupportedOperationException("Cannot set attributes on chained ops from a junction output port") - override def importAndGetPort(b: Builder[_]): Outlet[Out @uncheckedVariance] = outlet + override def importAndGetPort(b: Builder[?]): Outlet[Out @uncheckedVariance] = outlet override def via[T, Mat2](flow: Graph[FlowShape[Out, T], Mat2]): Repr[T] = super.~>(flow)(b) @@ -1856,60 +1856,60 @@ object GraphDSL extends GraphApply { } private class DisabledPortOps[Out](msg: String) extends PortOpsImpl[Out](null, null) { - override def importAndGetPort(b: Builder[_]): Outlet[Out] = throw new IllegalArgumentException(msg) + override def importAndGetPort(b: Builder[?]): Outlet[Out] = throw new IllegalArgumentException(msg) override def via[T, Mat2](flow: Graph[FlowShape[Out, T], Mat2]): Repr[T] = throw new IllegalArgumentException(msg) } implicit class ReversePortOps[In](val inlet: Inlet[In]) extends ReverseCombinerBase[In] { - override def importAndGetPortReverse(b: Builder[_]): Inlet[In] = inlet + override def importAndGetPortReverse(b: Builder[?]): Inlet[In] = inlet } final class DisabledReversePortOps[In](msg: String) extends ReversePortOps[In](null) { - override def importAndGetPortReverse(b: Builder[_]): Inlet[In] = throw new IllegalArgumentException(msg) + override def importAndGetPortReverse(b: Builder[?]): Inlet[In] = throw new IllegalArgumentException(msg) } implicit final class FanInOps[In, Out](val j: UniformFanInShape[In, Out]) extends AnyVal with CombinerBase[Out] with ReverseCombinerBase[In] { - override def importAndGetPort(b: Builder[_]): Outlet[Out] = j.out - override def importAndGetPortReverse(b: Builder[_]): Inlet[In] = findIn(b, j, 0) + override def importAndGetPort(b: Builder[?]): Outlet[Out] = j.out + override def importAndGetPortReverse(b: Builder[?]): Inlet[In] = findIn(b, j, 0) } implicit final class FanOutOps[In, Out](val j: UniformFanOutShape[In, Out]) extends AnyVal with ReverseCombinerBase[In] { - override def importAndGetPortReverse(b: Builder[_]): Inlet[In] = j.in + override def importAndGetPortReverse(b: Builder[?]): Inlet[In] = j.in } - implicit final class SinkArrow[T](val s: Graph[SinkShape[T], _]) extends AnyVal with ReverseCombinerBase[T] { - override def importAndGetPortReverse(b: Builder[_]): Inlet[T] = b.add(s).in + implicit final class SinkArrow[T](val s: Graph[SinkShape[T], ?]) extends AnyVal with ReverseCombinerBase[T] { + override def importAndGetPortReverse(b: Builder[?]): Inlet[T] = b.add(s).in } implicit final class SinkShapeArrow[T](val s: SinkShape[T]) extends AnyVal with ReverseCombinerBase[T] { - override def importAndGetPortReverse(b: Builder[_]): Inlet[T] = s.in + override def importAndGetPortReverse(b: Builder[?]): Inlet[T] = s.in } implicit final class FlowShapeArrow[I, O](val f: FlowShape[I, O]) extends AnyVal with ReverseCombinerBase[I] { - override def importAndGetPortReverse(b: Builder[_]): Inlet[I] = f.in + override def importAndGetPortReverse(b: Builder[?]): Inlet[I] = f.in def <~>[I2, O2, Mat](bidi: Graph[BidiShape[O, O2, I2, I], Mat])( - implicit b: Builder[_]): BidiShape[O, O2, I2, I] = { + implicit b: Builder[?]): BidiShape[O, O2, I2, I] = { val shape = b.add(bidi) b.addEdge(f.out, shape.in1) b.addEdge(shape.out2, f.in) shape } - def <~>[I2, O2](bidi: BidiShape[O, O2, I2, I])(implicit b: Builder[_]): BidiShape[O, O2, I2, I] = { + def <~>[I2, O2](bidi: BidiShape[O, O2, I2, I])(implicit b: Builder[?]): BidiShape[O, O2, I2, I] = { b.addEdge(f.out, bidi.in1) b.addEdge(bidi.out2, f.in) bidi } - def <~>[M](flow: Graph[FlowShape[O, I], M])(implicit b: Builder[_]): Unit = { + def <~>[M](flow: Graph[FlowShape[O, I], M])(implicit b: Builder[?]): Unit = { val shape = b.add(flow) b.addEdge(shape.out, f.in) b.addEdge(f.out, shape.in) @@ -1918,7 +1918,7 @@ object GraphDSL extends GraphApply { implicit final class FlowArrow[I, O, M](val f: Graph[FlowShape[I, O], M]) extends AnyVal { def <~>[I2, O2, Mat](bidi: Graph[BidiShape[O, O2, I2, I], Mat])( - implicit b: Builder[_]): BidiShape[O, O2, I2, I] = { + implicit b: Builder[?]): BidiShape[O, O2, I2, I] = { val shape = b.add(bidi) val flow = b.add(f) b.addEdge(flow.out, shape.in1) @@ -1926,14 +1926,14 @@ object GraphDSL extends GraphApply { shape } - def <~>[I2, O2](bidi: BidiShape[O, O2, I2, I])(implicit b: Builder[_]): BidiShape[O, O2, I2, I] = { + def <~>[I2, O2](bidi: BidiShape[O, O2, I2, I])(implicit b: Builder[?]): BidiShape[O, O2, I2, I] = { val flow = b.add(f) b.addEdge(flow.out, bidi.in1) b.addEdge(bidi.out2, flow.in) bidi } - def <~>[M2](flow: Graph[FlowShape[O, I], M2])(implicit b: Builder[_]): Unit = { + def <~>[M2](flow: Graph[FlowShape[O, I], M2])(implicit b: Builder[?]): Unit = { val shape = b.add(flow) val ff = b.add(f) b.addEdge(shape.out, ff.in) @@ -1942,26 +1942,26 @@ object GraphDSL extends GraphApply { } implicit final class BidiFlowShapeArrow[I1, O1, I2, O2](val bidi: BidiShape[I1, O1, I2, O2]) extends AnyVal { - def <~>[I3, O3](other: BidiShape[O1, O3, I3, I2])(implicit b: Builder[_]): BidiShape[O1, O3, I3, I2] = { + def <~>[I3, O3](other: BidiShape[O1, O3, I3, I2])(implicit b: Builder[?]): BidiShape[O1, O3, I3, I2] = { b.addEdge(bidi.out1, other.in1) b.addEdge(other.out2, bidi.in2) other } def <~>[I3, O3, M](otherFlow: Graph[BidiShape[O1, O3, I3, I2], M])( - implicit b: Builder[_]): BidiShape[O1, O3, I3, I2] = { + implicit b: Builder[?]): BidiShape[O1, O3, I3, I2] = { val other = b.add(otherFlow) b.addEdge(bidi.out1, other.in1) b.addEdge(other.out2, bidi.in2) other } - def <~>(flow: FlowShape[O1, I2])(implicit b: Builder[_]): Unit = { + def <~>(flow: FlowShape[O1, I2])(implicit b: Builder[?]): Unit = { b.addEdge(bidi.out1, flow.in) b.addEdge(flow.out, bidi.in2) } - def <~>[M](f: Graph[FlowShape[O1, I2], M])(implicit b: Builder[_]): Unit = { + def <~>[M](f: Graph[FlowShape[O1, I2], M])(implicit b: Builder[?]): Unit = { val flow = b.add(f) b.addEdge(bidi.out1, flow.in) b.addEdge(flow.out, bidi.in2) @@ -1970,21 +1970,21 @@ object GraphDSL extends GraphApply { import scala.language.implicitConversions - implicit def port2flow[T](from: Outlet[T])(implicit b: Builder[_]): PortOps[T] = + implicit def port2flow[T](from: Outlet[T])(implicit b: Builder[?]): PortOps[T] = new PortOpsImpl(from, b) - implicit def fanOut2flow[I, O](j: UniformFanOutShape[I, O])(implicit b: Builder[_]): PortOps[O] = + implicit def fanOut2flow[I, O](j: UniformFanOutShape[I, O])(implicit b: Builder[?]): PortOps[O] = new PortOpsImpl(findOut(b, j, 0), b) - implicit def flow2flow[I, O](f: FlowShape[I, O])(implicit b: Builder[_]): PortOps[O] = + implicit def flow2flow[I, O](f: FlowShape[I, O])(implicit b: Builder[?]): PortOps[O] = new PortOpsImpl(f.out, b) - implicit final class SourceArrow[T](val s: Graph[SourceShape[T], _]) extends AnyVal with CombinerBase[T] { - override def importAndGetPort(b: Builder[_]): Outlet[T] = b.add(s).out + implicit final class SourceArrow[T](val s: Graph[SourceShape[T], ?]) extends AnyVal with CombinerBase[T] { + override def importAndGetPort(b: Builder[?]): Outlet[T] = b.add(s).out } implicit final class SourceShapeArrow[T](val s: SourceShape[T]) extends AnyVal with CombinerBase[T] { - override def importAndGetPort(b: Builder[_]): Outlet[T] = s.out + override def importAndGetPort(b: Builder[?]): Outlet[T] = s.out } } } diff --git a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/RestartFlow.scala b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/RestartFlow.scala index a257876d85e..bf87f83b0d8 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/RestartFlow.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/RestartFlow.scala @@ -63,7 +63,7 @@ object RestartFlow { @deprecated("Use the overloaded method which accepts org.apache.pekko.stream.RestartSettings instead.", since = "Akka 2.6.10") def withBackoff[In, Out](minBackoff: FiniteDuration, maxBackoff: FiniteDuration, randomFactor: Double)( - flowFactory: () => Flow[In, Out, _]): Flow[In, Out, NotUsed] = { + flowFactory: () => Flow[In, Out, ?]): Flow[In, Out, NotUsed] = { val settings = RestartSettings(minBackoff, maxBackoff, randomFactor) withBackoff(settings)(flowFactory) } @@ -99,7 +99,7 @@ object RestartFlow { minBackoff: FiniteDuration, maxBackoff: FiniteDuration, randomFactor: Double, - maxRestarts: Int)(flowFactory: () => Flow[In, Out, _]): Flow[In, Out, NotUsed] = { + maxRestarts: Int)(flowFactory: () => Flow[In, Out, ?]): Flow[In, Out, NotUsed] = { val settings = RestartSettings(minBackoff, maxBackoff, randomFactor).withMaxRestarts(maxRestarts, minBackoff) withBackoff(settings)(flowFactory) } @@ -122,7 +122,7 @@ object RestartFlow { * @param settings [[RestartSettings]] defining restart configuration * @param flowFactory A factory for producing the [[Flow]] to wrap. */ - def withBackoff[In, Out](settings: RestartSettings)(flowFactory: () => Flow[In, Out, _]): Flow[In, Out, NotUsed] = + def withBackoff[In, Out](settings: RestartSettings)(flowFactory: () => Flow[In, Out, ?]): Flow[In, Out, NotUsed] = Flow.fromGraph(new RestartWithBackoffFlow(flowFactory, settings, onlyOnFailures = false)) /** @@ -157,7 +157,7 @@ object RestartFlow { minBackoff: FiniteDuration, maxBackoff: FiniteDuration, randomFactor: Double, - maxRestarts: Int)(flowFactory: () => Flow[In, Out, _]): Flow[In, Out, NotUsed] = { + maxRestarts: Int)(flowFactory: () => Flow[In, Out, ?]): Flow[In, Out, NotUsed] = { val settings = RestartSettings(minBackoff, maxBackoff, randomFactor).withMaxRestarts(maxRestarts, minBackoff) onFailuresWithBackoff(settings)(flowFactory) } @@ -182,13 +182,13 @@ object RestartFlow { * @param flowFactory A factory for producing the [[Flow]] to wrap. */ def onFailuresWithBackoff[In, Out](settings: RestartSettings)( - flowFactory: () => Flow[In, Out, _]): Flow[In, Out, NotUsed] = + flowFactory: () => Flow[In, Out, ?]): Flow[In, Out, NotUsed] = Flow.fromGraph(new RestartWithBackoffFlow(flowFactory, settings, onlyOnFailures = true)) } private final class RestartWithBackoffFlow[In, Out]( - flowFactory: () => Flow[In, Out, _], + flowFactory: () => Flow[In, Out, ?], settings: RestartSettings, onlyOnFailures: Boolean) extends GraphStage[FlowShape[In, Out]] { self => @@ -264,7 +264,7 @@ private abstract class RestartWithBackoffLogic[S <: Shape]( // don't want to restart the sub inlet when it finishes, we just finish normally. var finishing = false - override protected def logSource: Class[_] = classOf[RestartWithBackoffLogic[_]] + override protected def logSource: Class[?] = classOf[RestartWithBackoffLogic[?]] protected def startGraph(): Unit protected def backoff(): Unit @@ -457,7 +457,7 @@ object RestartWithBackoffFlow { override def createLogic(inheritedAttributes: Attributes): GraphStageLogic = new TimerGraphStageLogic(shape) with InHandler with OutHandler with StageLogging { - override protected def logSource: Class[_] = classOf[DelayCancellationStage[_]] + override protected def logSource: Class[?] = classOf[DelayCancellationStage[?]] private var cause: OptionVal[Throwable] = OptionVal.None diff --git a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/RestartSink.scala b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/RestartSink.scala index 02743ce1ef6..e9c9c0fcc92 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/RestartSink.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/RestartSink.scala @@ -56,7 +56,7 @@ object RestartSink { @deprecated("Use the overloaded method which accepts org.apache.pekko.stream.RestartSettings instead.", since = "Akka 2.6.10") def withBackoff[T](minBackoff: FiniteDuration, maxBackoff: FiniteDuration, randomFactor: Double)( - sinkFactory: () => Sink[T, _]): Sink[T, NotUsed] = { + sinkFactory: () => Sink[T, ?]): Sink[T, NotUsed] = { val settings = RestartSettings(minBackoff, maxBackoff, randomFactor) withBackoff(settings)(sinkFactory) } @@ -90,7 +90,7 @@ object RestartSink { @deprecated("Use the overloaded method which accepts org.apache.pekko.stream.RestartSettings instead.", since = "Akka 2.6.10") def withBackoff[T](minBackoff: FiniteDuration, maxBackoff: FiniteDuration, randomFactor: Double, maxRestarts: Int)( - sinkFactory: () => Sink[T, _]): Sink[T, NotUsed] = { + sinkFactory: () => Sink[T, ?]): Sink[T, NotUsed] = { val settings = RestartSettings(minBackoff, maxBackoff, randomFactor).withMaxRestarts(maxRestarts, minBackoff) withBackoff(settings)(sinkFactory) } @@ -114,11 +114,11 @@ object RestartSink { * @param settings [[RestartSettings]] defining restart configuration * @param sinkFactory A factory for producing the [[Sink]] to wrap. */ - def withBackoff[T](settings: RestartSettings)(sinkFactory: () => Sink[T, _]): Sink[T, NotUsed] = + def withBackoff[T](settings: RestartSettings)(sinkFactory: () => Sink[T, ?]): Sink[T, NotUsed] = Sink.fromGraph(new RestartWithBackoffSink(sinkFactory, settings)) } -private final class RestartWithBackoffSink[T](sinkFactory: () => Sink[T, _], restartSettings: RestartSettings) +private final class RestartWithBackoffSink[T](sinkFactory: () => Sink[T, ?], restartSettings: RestartSettings) extends GraphStage[SinkShape[T]] { self => val in = Inlet[T]("RestartWithBackoffSink.in") diff --git a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/RestartSource.scala b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/RestartSource.scala index aba594accd0..0e22f89b505 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/RestartSource.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/RestartSource.scala @@ -52,7 +52,7 @@ object RestartSource { @deprecated("Use the overloaded method which accepts org.apache.pekko.stream.RestartSettings instead.", since = "Akka 2.6.10") def withBackoff[T](minBackoff: FiniteDuration, maxBackoff: FiniteDuration, randomFactor: Double)( - sourceFactory: () => Source[T, _]): Source[T, NotUsed] = { + sourceFactory: () => Source[T, ?]): Source[T, NotUsed] = { val settings = RestartSettings(minBackoff, maxBackoff, randomFactor) withBackoff(settings)(sourceFactory) } @@ -83,7 +83,7 @@ object RestartSource { @deprecated("Use the overloaded method which accepts org.apache.pekko.stream.RestartSettings instead.", since = "Akka 2.6.10") def withBackoff[T](minBackoff: FiniteDuration, maxBackoff: FiniteDuration, randomFactor: Double, maxRestarts: Int)( - sourceFactory: () => Source[T, _]): Source[T, NotUsed] = { + sourceFactory: () => Source[T, ?]): Source[T, NotUsed] = { val settings = RestartSettings(minBackoff, maxBackoff, randomFactor).withMaxRestarts(maxRestarts, minBackoff) withBackoff(settings)(sourceFactory) } @@ -104,7 +104,7 @@ object RestartSource { * @param settings [[RestartSettings]] defining restart configuration * @param sourceFactory A factory for producing the [[Source]] to wrap. */ - def withBackoff[T](settings: RestartSettings)(sourceFactory: () => Source[T, _]): Source[T, NotUsed] = + def withBackoff[T](settings: RestartSettings)(sourceFactory: () => Source[T, ?]): Source[T, NotUsed] = Source.fromGraph(new RestartWithBackoffSource(sourceFactory, settings, onlyOnFailures = false)) /** @@ -130,7 +130,7 @@ object RestartSource { @deprecated("Use the overloaded method which accepts org.apache.pekko.stream.RestartSettings instead.", since = "Akka 2.6.10") def onFailuresWithBackoff[T](minBackoff: FiniteDuration, maxBackoff: FiniteDuration, randomFactor: Double)( - sourceFactory: () => Source[T, _]): Source[T, NotUsed] = { + sourceFactory: () => Source[T, ?]): Source[T, NotUsed] = { val settings = RestartSettings(minBackoff, maxBackoff, randomFactor) onFailuresWithBackoff(settings)(sourceFactory) } @@ -163,7 +163,7 @@ object RestartSource { minBackoff: FiniteDuration, maxBackoff: FiniteDuration, randomFactor: Double, - maxRestarts: Int)(sourceFactory: () => Source[T, _]): Source[T, NotUsed] = { + maxRestarts: Int)(sourceFactory: () => Source[T, ?]): Source[T, NotUsed] = { val settings = RestartSettings(minBackoff, maxBackoff, randomFactor).withMaxRestarts(maxRestarts, minBackoff) onFailuresWithBackoff(settings)(sourceFactory) } @@ -183,12 +183,12 @@ object RestartSource { * @param settings [[RestartSettings]] defining restart configuration * @param sourceFactory A factory for producing the [[Source]] to wrap. */ - def onFailuresWithBackoff[T](settings: RestartSettings)(sourceFactory: () => Source[T, _]): Source[T, NotUsed] = + def onFailuresWithBackoff[T](settings: RestartSettings)(sourceFactory: () => Source[T, ?]): Source[T, NotUsed] = Source.fromGraph(new RestartWithBackoffSource(sourceFactory, settings, onlyOnFailures = true)) } private final class RestartWithBackoffSource[T]( - sourceFactory: () => Source[T, _], + sourceFactory: () => Source[T, ?], settings: RestartSettings, onlyOnFailures: Boolean) extends GraphStage[SourceShape[T]] { self => diff --git a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Sink.scala b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Sink.scala index 935796a4789..ce6b8910291 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Sink.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Sink.scala @@ -287,7 +287,7 @@ object Sink { * * See also [[Flow.limit]], [[Flow.limitWeighted]], [[Flow.take]], [[Flow.takeWithin]], [[Flow.takeWhile]] */ - def collection[T, That](implicit cbf: Factory[T, That with immutable.Iterable[_]]): Sink[T, Future[That]] = + def collection[T, That](implicit cbf: Factory[T, That with immutable.Iterable[?]]): Sink[T, Future[That]] = Sink.fromGraph(new SeqStage[T, That]) /** @@ -338,7 +338,7 @@ object Sink { /** * Combine several sinks with fan-out strategy like `Broadcast` or `Balance` and returns `Sink`. */ - def combine[T, U](first: Sink[U, _], second: Sink[U, _], rest: Sink[U, _]*)( + def combine[T, U](first: Sink[U, ?], second: Sink[U, ?], rest: Sink[U, ?]*)( @nowarn @deprecatedName(Symbol("strategy")) fanOutStrategy: Int => Graph[UniformFanOutShape[T, U], NotUsed]): Sink[T, NotUsed] = @@ -348,7 +348,7 @@ object Sink { d.out(0) ~> first d.out(1) ~> second - @tailrec def combineRest(idx: Int, i: Iterator[Sink[U, _]]): SinkShape[T] = + @tailrec def combineRest(idx: Int, i: Iterator[Sink[U, ?]]): SinkShape[T] = if (i.hasNext) { d.out(idx) ~> i.next() combineRest(idx + 1, i) diff --git a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Source.scala b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Source.scala index a222f74ae50..8d9f9d620a5 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Source.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Source.scala @@ -239,7 +239,7 @@ final class Source[+Out, +Mat]( * Combines several sources with fan-in strategy like `Merge` or `Concat` and returns `Source`. */ @deprecated("Use `Source.combine` on companion object instead", "Akka 2.5.5") - def combine[T, U](first: Source[T, _], second: Source[T, _], rest: Source[T, _]*)( + def combine[T, U](first: Source[T, ?], second: Source[T, ?], rest: Source[T, ?]*)( strategy: Int => Graph[UniformFanInShape[T, U], NotUsed]): Source[U, NotUsed] = Source.combine(first, second, rest: _*)(strategy) @@ -395,7 +395,7 @@ object Source { */ @deprecated("Use scala-compat CompletionStage to future converter and 'Source.futureSource' instead", "Akka 2.6.0") def fromSourceCompletionStage[T, M]( - completion: CompletionStage[_ <: Graph[SourceShape[T], M]]): Source[T, CompletionStage[M]] = + completion: CompletionStage[? <: Graph[SourceShape[T], M]]): Source[T, CompletionStage[M]] = fromFutureSource(completion.asScala).mapMaterializedValue(_.asJava) /** @@ -755,7 +755,7 @@ object Source { /** * Combines several sources with fan-in strategy like [[Merge]] or [[Concat]] into a single [[Source]]. */ - def combine[T, U](first: Source[T, _], second: Source[T, _], rest: Source[T, _]*)( + def combine[T, U](first: Source[T, ?], second: Source[T, ?], rest: Source[T, ?]*)( @nowarn @deprecatedName(Symbol("strategy")) fanInStrategy: Int => Graph[UniformFanInShape[T, U], NotUsed]): Source[U, NotUsed] = @@ -765,7 +765,7 @@ object Source { first ~> c.in(0) second ~> c.in(1) - @tailrec def combineRest(idx: Int, i: Iterator[Source[T, _]]): SourceShape[U] = + @tailrec def combineRest(idx: Int, i: Iterator[Source[T, ?]]): SourceShape[U] = if (i.hasNext) { i.next() ~> c.in(idx) combineRest(idx + 1, i) @@ -812,13 +812,13 @@ object Source { /** * Combine the elements of multiple streams into a stream of sequences. */ - def zipN[T](sources: immutable.Seq[Source[T, _]]): Source[immutable.Seq[T], NotUsed] = + def zipN[T](sources: immutable.Seq[Source[T, ?]]): Source[immutable.Seq[T], NotUsed] = zipWithN(ConstantFun.scalaIdentityFunction[immutable.Seq[T]])(sources).addAttributes(DefaultAttributes.zipN) /** * Combine the elements of multiple streams into a stream of sequences using a combiner function. */ - def zipWithN[T, O](zipper: immutable.Seq[T] => O)(sources: immutable.Seq[Source[T, _]]): Source[O, NotUsed] = { + def zipWithN[T, O](zipper: immutable.Seq[T] => O)(sources: immutable.Seq[Source[T, ?]]): Source[O, NotUsed] = { val source = sources match { case immutable.Seq() => empty[O] case immutable.Seq(source) => source.map(t => zipper(immutable.Seq(t))).mapMaterializedValue(_ => NotUsed) @@ -1004,7 +1004,7 @@ object Source { * '''Cancels when''' downstream cancels */ def mergePrioritizedN[T]( - sourcesAndPriorities: immutable.Seq[(Source[T, _], Int)], + sourcesAndPriorities: immutable.Seq[(Source[T, ?], Int)], eagerComplete: Boolean): Source[T, NotUsed] = { sourcesAndPriorities match { case immutable.Seq() => Source.empty diff --git a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/StreamConverters.scala b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/StreamConverters.scala index 7b1a743889a..3552c0dea79 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/StreamConverters.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/StreamConverters.scala @@ -115,7 +115,7 @@ object StreamConverters { * Note that a flow can be materialized multiple times, so the function producing the ``Collector`` must be able * to handle multiple invocations. */ - def javaCollector[T, R](collectorFactory: () => java.util.stream.Collector[T, _ <: Any, R]): Sink[T, Future[R]] = + def javaCollector[T, R](collectorFactory: () => java.util.stream.Collector[T, ? <: Any, R]): Sink[T, Future[R]] = Flow[T] .fold { new FirstCollectorState[T, @@ -139,7 +139,7 @@ object StreamConverters { * to handle multiple invocations. */ def javaCollectorParallelUnordered[T, R](parallelism: Int)( - collectorFactory: () => java.util.stream.Collector[T, _ <: Any, R]): Sink[T, Future[R]] = { + collectorFactory: () => java.util.stream.Collector[T, ? <: Any, R]): Sink[T, Future[R]] = { if (parallelism == 1) javaCollector[T, R](collectorFactory) else { Sink 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 89f15efbac3..2fe96029cec 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 @@ -181,7 +181,7 @@ final class Tcp(system: ExtendedActorSystem) extends pekko.actor.Extension { * for servers, and therefore it is the default setting. */ def bindAndHandle( - handler: Flow[ByteString, ByteString, _], + handler: Flow[ByteString, ByteString, ?], interface: String, port: Int, backlog: Int = defaultBacklog, @@ -443,7 +443,7 @@ final class Tcp(system: ExtendedActorSystem) extends pekko.actor.Extension { * @see [[Tcp.bindAndHandle]] */ def bindAndHandleWithTls( - handler: Flow[ByteString, ByteString, _], + handler: Flow[ByteString, ByteString, ?], interface: String, port: Int, createSSLEngine: () => SSLEngine)(implicit m: Materializer): Future[ServerBinding] = @@ -469,7 +469,7 @@ final class Tcp(system: ExtendedActorSystem) extends pekko.actor.Extension { * @see [[Tcp.bindAndHandle]] */ def bindAndHandleWithTls( - handler: Flow[ByteString, ByteString, _], + handler: Flow[ByteString, ByteString, ?], interface: String, port: Int, createSSLEngine: () => SSLEngine, @@ -500,7 +500,7 @@ final class Tcp(system: ExtendedActorSystem) extends pekko.actor.Extension { "Setup the SSLEngine with needed parameters.", "Akka 2.6.0") def bindAndHandleTls( - handler: Flow[ByteString, ByteString, _], + handler: Flow[ByteString, ByteString, ?], interface: String, port: Int, sslContext: SSLContext, diff --git a/stream/src/main/scala/org/apache/pekko/stream/serialization/StreamRefSerializer.scala b/stream/src/main/scala/org/apache/pekko/stream/serialization/StreamRefSerializer.scala index 24b9a97c99b..daa66f753c2 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/serialization/StreamRefSerializer.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/serialization/StreamRefSerializer.scala @@ -43,7 +43,7 @@ private[pekko] final class StreamRefSerializer(val system: ExtendedActorSystem) override def manifest(o: AnyRef): String = o match { // protocol - case _: StreamRefsProtocol.SequencedOnNext[_] => SequencedOnNextManifest + case _: StreamRefsProtocol.SequencedOnNext[?] => SequencedOnNextManifest case _: StreamRefsProtocol.CumulativeDemand => CumulativeDemandManifest // handshake case _: StreamRefsProtocol.OnSubscribeHandshake => OnSubscribeHandshakeManifest @@ -51,9 +51,9 @@ private[pekko] final class StreamRefSerializer(val system: ExtendedActorSystem) case _: StreamRefsProtocol.RemoteStreamFailure => RemoteSinkFailureManifest case _: StreamRefsProtocol.RemoteStreamCompleted => RemoteSinkCompletedManifest // refs - case _: SourceRefImpl[_] => SourceRefManifest + case _: SourceRefImpl[?] => SourceRefManifest // case _: MaterializedSourceRef[_] => SourceRefManifest - case _: SinkRefImpl[_] => SinkRefManifest + case _: SinkRefImpl[?] => SinkRefManifest // case _: MaterializedSinkRef[_] => SinkRefManifest case StreamRefsProtocol.Ack => AckManifest case unknown => throw new IllegalArgumentException(s"Unsupported object ${unknown.getClass}") @@ -61,7 +61,7 @@ private[pekko] final class StreamRefSerializer(val system: ExtendedActorSystem) override def toBinary(o: AnyRef): Array[Byte] = o match { // protocol - case o: StreamRefsProtocol.SequencedOnNext[_] => serializeSequencedOnNext(o).toByteArray + case o: StreamRefsProtocol.SequencedOnNext[?] => serializeSequencedOnNext(o).toByteArray case d: StreamRefsProtocol.CumulativeDemand => serializeCumulativeDemand(d).toByteArray // handshake case h: StreamRefsProtocol.OnSubscribeHandshake => serializeOnSubscribeHandshake(h).toByteArray @@ -69,9 +69,9 @@ private[pekko] final class StreamRefSerializer(val system: ExtendedActorSystem) case d: StreamRefsProtocol.RemoteStreamFailure => serializeRemoteSinkFailure(d).toByteArray case d: StreamRefsProtocol.RemoteStreamCompleted => serializeRemoteSinkCompleted(d).toByteArray // refs - case ref: SinkRefImpl[_] => serializeSinkRef(ref).toByteArray + case ref: SinkRefImpl[?] => serializeSinkRef(ref).toByteArray // case ref: MaterializedSinkRef[_] => ??? // serializeSinkRef(ref).toByteArray - case ref: SourceRefImpl[_] => serializeSourceRef(ref).toByteArray + case ref: SourceRefImpl[?] => serializeSourceRef(ref).toByteArray // case ref: MaterializedSourceRef[_] => serializeSourceRef(ref.).toByteArray case StreamRefsProtocol.Ack => Array.emptyByteArray case unknown => throw new IllegalArgumentException(s"Unsupported object ${unknown.getClass}") @@ -121,7 +121,7 @@ private[pekko] final class StreamRefSerializer(val system: ExtendedActorSystem) .build() } - private def serializeSequencedOnNext(o: StreamRefsProtocol.SequencedOnNext[_]) = { + private def serializeSequencedOnNext(o: StreamRefsProtocol.SequencedOnNext[?]) = { val p = o.payload.asInstanceOf[AnyRef] val msgSerializer = serialization.findSerializerFor(p) @@ -136,7 +136,7 @@ private[pekko] final class StreamRefSerializer(val system: ExtendedActorSystem) StreamRefMessages.SequencedOnNext.newBuilder().setSeqNr(o.seqNr).setPayload(payloadBuilder.build()).build() } - private def serializeSinkRef(sink: SinkRefImpl[_]): StreamRefMessages.SinkRef = { + private def serializeSinkRef(sink: SinkRefImpl[?]): StreamRefMessages.SinkRef = { StreamRefMessages.SinkRef .newBuilder() .setTargetRef( @@ -144,7 +144,7 @@ private[pekko] final class StreamRefSerializer(val system: ExtendedActorSystem) .build() } - private def serializeSourceRef(source: SourceRefImpl[_]): StreamRefMessages.SourceRef = { + private def serializeSourceRef(source: SourceRefImpl[?]): StreamRefMessages.SourceRef = { StreamRefMessages.SourceRef .newBuilder() .setOriginRef( 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 b18630843fc..d5d984012b0 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 @@ -339,7 +339,7 @@ abstract class GraphStageLogic private[stream] (val inCount: Int, val outCount: * * If possible a link back to the operator that the logic was created with, used for debugging. */ - private[stream] var originalStage: OptionVal[GraphStageWithMaterializedValue[_ <: Shape, _]] = OptionVal.None + private[stream] var originalStage: OptionVal[GraphStageWithMaterializedValue[? <: Shape, ?]] = OptionVal.None /** * INTERNAL API @@ -453,7 +453,7 @@ abstract class GraphStageLogic private[stream] (val inCount: Int, val outCount: /** * Assigns callbacks for the events for an [[Inlet]] */ - final protected def setHandler(in: Inlet[_], handler: InHandler): Unit = { + final protected def setHandler(in: Inlet[?], handler: InHandler): Unit = { handlers(in.id) = handler if (_interpreter != null) _interpreter.setHandler(conn(in), handler) } @@ -461,7 +461,7 @@ abstract class GraphStageLogic private[stream] (val inCount: Int, val outCount: /** * Assign callbacks for linear operator for both [[Inlet]] and [[Outlet]] */ - final protected def setHandlers(in: Inlet[_], out: Outlet[_], handler: InHandler with OutHandler): Unit = { + final protected def setHandlers(in: Inlet[?], out: Outlet[?], handler: InHandler with OutHandler): Unit = { setHandler(in, handler) setHandler(out, handler) } @@ -469,31 +469,31 @@ abstract class GraphStageLogic private[stream] (val inCount: Int, val outCount: /** * Retrieves the current callback for the events on the given [[Inlet]] */ - final protected def getHandler(in: Inlet[_]): InHandler = { + final protected def getHandler(in: Inlet[?]): InHandler = { handlers(in.id).asInstanceOf[InHandler] } /** * Assigns callbacks for the events for an [[Outlet]] */ - final protected def setHandler(out: Outlet[_], handler: OutHandler): Unit = { + final protected def setHandler(out: Outlet[?], handler: OutHandler): Unit = { handlers(out.id + inCount) = handler if (_interpreter != null) _interpreter.setHandler(conn(out), handler) } - private def conn(in: Inlet[_]): Connection = portToConn(in.id) - private def conn(out: Outlet[_]): Connection = portToConn(out.id + inCount) + private def conn(in: Inlet[?]): Connection = portToConn(in.id) + private def conn(out: Outlet[?]): Connection = portToConn(out.id + inCount) /** * Retrieves the current callback for the events on the given [[Outlet]] */ - final protected def getHandler(out: Outlet[_]): OutHandler = { + final protected def getHandler(out: Outlet[?]): OutHandler = { handlers(out.id + inCount).asInstanceOf[OutHandler] } - private def getNonEmittingHandler(out: Outlet[_]): OutHandler = + private def getNonEmittingHandler(out: Outlet[?]): OutHandler = getHandler(out) match { - case e: Emitting[_] => e.previous + case e: Emitting[?] => e.previous case other => other } @@ -757,14 +757,14 @@ abstract class GraphStageLogic private[stream] (val inCount: Int, val outCount: private def cleanUpSubstreams(optionalFailureCause: OptionVal[Throwable]): Unit = { _subInletsAndOutlets.foreach { - case inlet: SubSinkInlet[_] => - val subSink = inlet.sink.asInstanceOf[SubSink[_]] + case inlet: SubSinkInlet[?] => + val subSink = inlet.sink.asInstanceOf[SubSink[?]] optionalFailureCause match { case OptionVal.Some(cause) => subSink.cancelSubstream(cause) case _ => subSink.cancelSubstream() } - case outlet: SubSourceOutlet[_] => - val subSource = outlet.source.asInstanceOf[SubSource[_]] + case outlet: SubSourceOutlet[?] => + val subSource = outlet.source.asInstanceOf[SubSource[?]] optionalFailureCause match { case OptionVal.Some(cause) => subSource.failSubstream(cause) case _ => subSource.completeSubstream() @@ -871,15 +871,15 @@ abstract class GraphStageLogic private[stream] (val inCount: Int, val outCount: * This will reinstall the replaced handler that was in effect before the `read` * call. */ - final protected def abortReading(in: Inlet[_]): Unit = + final protected def abortReading(in: Inlet[?]): Unit = getHandler(in) match { - case r: Reading[_] => + case r: Reading[?] => setHandler(in, r.previous) case _ => } - private def requireNotReading(in: Inlet[_]): Unit = - if (getHandler(in).isInstanceOf[Reading[_]]) + private def requireNotReading(in: Inlet[?]): Unit = + if (getHandler(in).isInstanceOf[Reading[?]]) throw new IllegalStateException("already reading on inlet " + in) /** @@ -1019,15 +1019,15 @@ abstract class GraphStageLogic private[stream] (val inCount: Int, val outCount: * This will reinstall the replaced handler that was in effect before the `emit` * call. */ - final protected def abortEmitting(out: Outlet[_]): Unit = + final protected def abortEmitting(out: Outlet[?]): Unit = getHandler(out) match { - case e: Emitting[_] => setHandler(out, e.previous) + case e: Emitting[?] => setHandler(out, e.previous) case _ => } private def setOrAddEmitting[T](out: Outlet[T], next: Emitting[T]): Unit = getHandler(out) match { - case e: Emitting[_] => e.asInstanceOf[Emitting[T]].addFollowUp(next) + case e: Emitting[?] => e.asInstanceOf[Emitting[T]].addFollowUp(next) case _ => setHandler(out, next) } @@ -1046,11 +1046,11 @@ abstract class GraphStageLogic private[stream] (val inCount: Int, val outCount: * we should add it to the end of emission queue */ val currentHandler = getHandler(out) - if (currentHandler.isInstanceOf[Emitting[_]]) + if (currentHandler.isInstanceOf[Emitting[?]]) addFollowUp(currentHandler.asInstanceOf[Emitting[T]]) val next = dequeue() - if (next.isInstanceOf[EmittingCompletion[_]]) { + if (next.isInstanceOf[EmittingCompletion[?]]) { /* * If next element is emitting completion and there are some elements after it, @@ -1280,7 +1280,7 @@ abstract class GraphStageLogic private[stream] (val inCount: Int, val outCount: final protected def createAsyncCallback[T](handler: Procedure[T]): AsyncCallback[T] = getAsyncCallback(handler.apply) - private var callbacksWaitingForInterpreter: List[ConcurrentAsyncCallback[_]] = Nil + private var callbacksWaitingForInterpreter: List[ConcurrentAsyncCallback[?]] = Nil // is used for two purposes: keep track of running callbacks and signal that the // stage has stopped to fail incoming async callback invocations by being set to null // Using ConcurrentHashMap's KeySetView as Set to track the inProgress async callbacks. @@ -1297,16 +1297,16 @@ abstract class GraphStageLogic private[stream] (val inCount: Int, val outCount: // when this stage completes/fails, not threadsafe only accessed from stream machinery callbacks etc. private var _subInletsAndOutlets: Set[AnyRef] = Set.empty - private def created(inlet: SubSinkInlet[_]): Unit = + private def created(inlet: SubSinkInlet[?]): Unit = _subInletsAndOutlets += inlet - private def completedOrFailed(inlet: SubSinkInlet[_]): Unit = + private def completedOrFailed(inlet: SubSinkInlet[?]): Unit = _subInletsAndOutlets -= inlet - private def created(outlet: SubSourceOutlet[_]): Unit = + private def created(outlet: SubSourceOutlet[?]): Unit = _subInletsAndOutlets += outlet - private def completedOrFailed(outlet: SubSourceOutlet[_]): Unit = + private def completedOrFailed(outlet: SubSourceOutlet[?]): Unit = _subInletsAndOutlets -= outlet /** diff --git a/stream/src/main/scala/org/apache/pekko/stream/stage/StageLogging.scala b/stream/src/main/scala/org/apache/pekko/stream/stage/StageLogging.scala index a2ac9fc0f95..f19546549b4 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/stage/StageLogging.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/stage/StageLogging.scala @@ -33,7 +33,7 @@ trait StageLogging { self: GraphStageLogic => private[this] var _log: LoggingAdapter = _ /** Override to customise reported log source */ - protected def logSource: Class[_] = this.getClass + protected def logSource: Class[?] = this.getClass def log: LoggingAdapter = { // only used in StageLogic, i.e. thread safe diff --git a/testkit/src/main/scala/org/apache/pekko/testkit/TestEventListener.scala b/testkit/src/main/scala/org/apache/pekko/testkit/TestEventListener.scala index 0071d1cc6a2..bd4096f2846 100644 --- a/testkit/src/main/scala/org/apache/pekko/testkit/TestEventListener.scala +++ b/testkit/src/main/scala/org/apache/pekko/testkit/TestEventListener.scala @@ -322,7 +322,7 @@ object EventFilter { * If you want to match all Error events, the most efficient is to use Left(""). */ final case class ErrorFilter( - throwable: Class[_], + throwable: Class[?], override val source: Option[String], override val message: Either[String, Regex], override val complete: Boolean)(occurrences: Int) @@ -353,7 +353,7 @@ final case class ErrorFilter( * whether the event’s message must match the given message string or pattern completely */ def this( - throwable: Class[_], + throwable: Class[?], source: String, message: String, pattern: Boolean, @@ -370,7 +370,7 @@ final case class ErrorFilter( /** * Java API: filter only on the given type of exception */ - def this(throwable: Class[_]) = this(throwable, null, null, false, false, Int.MaxValue) + def this(throwable: Class[?]) = this(throwable, null, null, false, false, Int.MaxValue) } @@ -530,7 +530,7 @@ object DeadLettersFilter { * Filter which matches DeadLetter events, if the wrapped message conforms to the * given type. */ -final case class DeadLettersFilter(val messageClass: Class[_])(occurrences: Int) extends EventFilter(occurrences) { +final case class DeadLettersFilter(val messageClass: Class[?])(occurrences: Int) extends EventFilter(occurrences) { def matches(event: LogEvent) = { event match { diff --git a/testkit/src/main/scala/org/apache/pekko/testkit/TestJavaSerializer.scala b/testkit/src/main/scala/org/apache/pekko/testkit/TestJavaSerializer.scala index 4dac31c04b0..ce9c762033c 100644 --- a/testkit/src/main/scala/org/apache/pekko/testkit/TestJavaSerializer.scala +++ b/testkit/src/main/scala/org/apache/pekko/testkit/TestJavaSerializer.scala @@ -42,7 +42,7 @@ class TestJavaSerializer(val system: ExtendedActorSystem) extends BaseSerializer bos.toByteArray } - def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = { + def fromBinary(bytes: Array[Byte], clazz: Option[Class[?]]): AnyRef = { val in = new ClassLoaderObjectInputStream(system.dynamicAccess.classLoader, new ByteArrayInputStream(bytes)) val obj = JavaSerializer.currentSystem.withValue(system) { in.readObject } in.close() diff --git a/testkit/src/main/scala/org/apache/pekko/testkit/TestKit.scala b/testkit/src/main/scala/org/apache/pekko/testkit/TestKit.scala index 1b43f585011..e67e4a9cae9 100644 --- a/testkit/src/main/scala/org/apache/pekko/testkit/TestKit.scala +++ b/testkit/src/main/scala/org/apache/pekko/testkit/TestKit.scala @@ -608,7 +608,7 @@ trait TestKitBase { /** * Same as `expectMsgAnyClassOf(remainingOrDefault, obj...)`, but correctly treating the timeFactor. */ - def expectMsgAnyClassOf[C](obj: Class[_ <: C]*): C = expectMsgAnyClassOf_internal(remainingOrDefault, obj: _*) + def expectMsgAnyClassOf[C](obj: Class[? <: C]*): C = expectMsgAnyClassOf_internal(remainingOrDefault, obj: _*) /** * Receive one message from the test actor and assert that it conforms to @@ -617,10 +617,10 @@ trait TestKitBase { * * @return the received object */ - def expectMsgAnyClassOf[C](max: FiniteDuration, obj: Class[_ <: C]*): C = + def expectMsgAnyClassOf[C](max: FiniteDuration, obj: Class[? <: C]*): C = expectMsgAnyClassOf_internal(max.dilated, obj: _*) - private def expectMsgAnyClassOf_internal[C](max: FiniteDuration, obj: Class[_ <: C]*): C = { + private def expectMsgAnyClassOf_internal[C](max: FiniteDuration, obj: Class[? <: C]*): C = { val o = receiveOne(max) assert(o ne null, s"timeout ($max) during expectMsgAnyClassOf waiting for ${obj.mkString("(", ", ", ")")}") assert(obj.exists(c => BoxedType(c).isInstance(o)), s"found unexpected $o") @@ -669,7 +669,7 @@ trait TestKitBase { /** * Same as `expectMsgAllClassOf(remainingOrDefault, obj...)`, but correctly treating the timeFactor. */ - def expectMsgAllClassOf[T](obj: Class[_ <: T]*): immutable.Seq[T] = + def expectMsgAllClassOf[T](obj: Class[? <: T]*): immutable.Seq[T] = internalExpectMsgAllClassOf(remainingOrDefault, obj: _*) /** @@ -680,10 +680,10 @@ trait TestKitBase { * Wait time is bounded by the given duration, with an AssertionFailure * being thrown in case of timeout. */ - def expectMsgAllClassOf[T](max: FiniteDuration, obj: Class[_ <: T]*): immutable.Seq[T] = + def expectMsgAllClassOf[T](max: FiniteDuration, obj: Class[? <: T]*): immutable.Seq[T] = internalExpectMsgAllClassOf(max.dilated, obj: _*) - private def internalExpectMsgAllClassOf[T](max: FiniteDuration, obj: Class[_ <: T]*): immutable.Seq[T] = { + private def internalExpectMsgAllClassOf[T](max: FiniteDuration, obj: Class[? <: T]*): immutable.Seq[T] = { val recv = receiveN_internal(obj.size, max) val missing = obj.filterNot(x => recv.exists(_.getClass eq BoxedType(x))) val unexpected = recv.filterNot(x => obj.exists(c => BoxedType(c) eq x.getClass)) @@ -694,7 +694,7 @@ trait TestKitBase { /** * Same as `expectMsgAllConformingOf(remainingOrDefault, obj...)`, but correctly treating the timeFactor. */ - def expectMsgAllConformingOf[T](obj: Class[_ <: T]*): immutable.Seq[T] = + def expectMsgAllConformingOf[T](obj: Class[? <: T]*): immutable.Seq[T] = internalExpectMsgAllConformingOf(remainingOrDefault, obj: _*) /** @@ -708,10 +708,10 @@ trait TestKitBase { * Beware that one object may satisfy all given class constraints, which * may be counter-intuitive. */ - def expectMsgAllConformingOf[T](max: FiniteDuration, obj: Class[_ <: T]*): immutable.Seq[T] = + def expectMsgAllConformingOf[T](max: FiniteDuration, obj: Class[? <: T]*): immutable.Seq[T] = internalExpectMsgAllConformingOf(max.dilated, obj: _*) - private def internalExpectMsgAllConformingOf[T](max: FiniteDuration, obj: Class[_ <: T]*): immutable.Seq[T] = { + private def internalExpectMsgAllConformingOf[T](max: FiniteDuration, obj: Class[? <: T]*): immutable.Seq[T] = { val recv = receiveN_internal(obj.size, max) val missing = obj.filterNot(x => recv.exists(BoxedType(x).isInstance(_))) val unexpected = recv.filterNot(x => obj.exists(c => BoxedType(c).isInstance(x))) diff --git a/testkit/src/main/scala/org/apache/pekko/testkit/TestKitUtils.scala b/testkit/src/main/scala/org/apache/pekko/testkit/TestKitUtils.scala index 67c471b4a1f..9694eeb61aa 100644 --- a/testkit/src/main/scala/org/apache/pekko/testkit/TestKitUtils.scala +++ b/testkit/src/main/scala/org/apache/pekko/testkit/TestKitUtils.scala @@ -25,7 +25,7 @@ import org.apache.pekko.annotation.InternalApi @InternalApi private[pekko] object TestKitUtils { - def testNameFromCallStack(classToStartFrom: Class[_], testKitRegex: Regex): String = { + def testNameFromCallStack(classToStartFrom: Class[?], testKitRegex: Regex): String = { def isAbstractClass(className: String): Boolean = { try { diff --git a/testkit/src/main/scala/org/apache/pekko/testkit/javadsl/EventFilter.scala b/testkit/src/main/scala/org/apache/pekko/testkit/javadsl/EventFilter.scala index b9f87520866..ca786b07cb2 100644 --- a/testkit/src/main/scala/org/apache/pekko/testkit/javadsl/EventFilter.scala +++ b/testkit/src/main/scala/org/apache/pekko/testkit/javadsl/EventFilter.scala @@ -20,21 +20,21 @@ import pekko.actor.ActorSystem import pekko.event.Logging import pekko.testkit.{ DebugFilter, ErrorFilter, InfoFilter, WarningFilter } -class EventFilter(clazz: Class[_], system: ActorSystem) { +class EventFilter(clazz: Class[?], system: ActorSystem) { require( classOf[Throwable].isAssignableFrom(clazz) || classOf[Logging.LogEvent].isAssignableFrom(clazz), "supplied class must either be LogEvent or Throwable") - private val _clazz: Class[_ <: Logging.LogEvent] = + private val _clazz: Class[? <: Logging.LogEvent] = if (classOf[Throwable].isAssignableFrom(clazz)) classOf[Logging.Error] else - clazz.asInstanceOf[Class[_ <: Logging.LogEvent]] + clazz.asInstanceOf[Class[? <: Logging.LogEvent]] - private var exceptionType: Class[_ <: Throwable] = + private var exceptionType: Class[? <: Throwable] = if (classOf[Throwable].isAssignableFrom(clazz)) - clazz.asInstanceOf[Class[_ <: Throwable]] + clazz.asInstanceOf[Class[? <: Throwable]] else null diff --git a/testkit/src/main/scala/org/apache/pekko/testkit/javadsl/TestKit.scala b/testkit/src/main/scala/org/apache/pekko/testkit/javadsl/TestKit.scala index b295655bd37..fa16967389d 100644 --- a/testkit/src/main/scala/org/apache/pekko/testkit/javadsl/TestKit.scala +++ b/testkit/src/main/scala/org/apache/pekko/testkit/javadsl/TestKit.scala @@ -607,7 +607,7 @@ class TestKit(system: ActorSystem) { * Same as `expectMsgAnyClassOf(remainingOrDefault, obj...)`, but correctly treating the timeFactor. */ @varargs - def expectMsgAnyClassOf[T](objs: Class[_]*): T = tp.expectMsgAnyClassOf(objs: _*).asInstanceOf[T] + def expectMsgAnyClassOf[T](objs: Class[?]*): T = tp.expectMsgAnyClassOf(objs: _*).asInstanceOf[T] /** * Receive one message from the test actor and assert that it conforms to @@ -616,7 +616,7 @@ class TestKit(system: ActorSystem) { */ @varargs @deprecated("Use the overloaded one which accepts java.time.Duration instead.", since = "Akka 2.5.12") - def expectMsgAnyClassOf[T](max: FiniteDuration, objs: Class[_]*): T = + def expectMsgAnyClassOf[T](max: FiniteDuration, objs: Class[?]*): T = tp.expectMsgAnyClassOf(max, objs: _*).asInstanceOf[T] /** @@ -625,7 +625,7 @@ class TestKit(system: ActorSystem) { * with an AssertionFailure being thrown in case of timeout. */ @varargs - def expectMsgAnyClassOf[T](max: java.time.Duration, objs: Class[_]*): T = + def expectMsgAnyClassOf[T](max: java.time.Duration, objs: Class[?]*): T = tp.expectMsgAnyClassOf(max.asScala, objs: _*).asInstanceOf[T] /** diff --git a/testkit/src/test/scala/org/apache/pekko/testkit/PekkoSpec.scala b/testkit/src/test/scala/org/apache/pekko/testkit/PekkoSpec.scala index 807b2f556fd..06af2fad57f 100644 --- a/testkit/src/test/scala/org/apache/pekko/testkit/PekkoSpec.scala +++ b/testkit/src/test/scala/org/apache/pekko/testkit/PekkoSpec.scala @@ -94,7 +94,7 @@ abstract class PekkoSpec(_system: ActorSystem) def this(s: String) = this(ConfigFactory.parseString(s)) - def this(configMap: Map[String, _]) = this(PekkoSpec.mapToConfig(configMap)) + def this(configMap: Map[String, ?]) = this(PekkoSpec.mapToConfig(configMap)) def this() = this(ActorSystem(TestKitUtils.testNameFromCallStack(classOf[PekkoSpec], "".r), PekkoSpec.testConf)) @@ -128,9 +128,9 @@ abstract class PekkoSpec(_system: ActorSystem) override def expectedTestDuration: FiniteDuration = 60 seconds - def muteDeadLetters(messageClasses: Class[_]*)(sys: ActorSystem = system): Unit = + def muteDeadLetters(messageClasses: Class[?]*)(sys: ActorSystem = system): Unit = if (!sys.log.isDebugEnabled) { - def mute(clazz: Class[_]): Unit = + def mute(clazz: Class[?]): Unit = sys.eventStream.publish(Mute(DeadLettersFilter(clazz)(occurrences = Int.MaxValue))) if (messageClasses.isEmpty) mute(classOf[AnyRef]) else messageClasses.foreach(mute) @@ -142,7 +142,7 @@ abstract class PekkoSpec(_system: ActorSystem) def areEqual(a: Class[A], b: Class[B]) = a == b } - implicit def setEqualityConstraint[A, T <: Set[_ <: A]]: CanEqual[Set[A], T] = + implicit def setEqualityConstraint[A, T <: Set[? <: A]]: CanEqual[Set[A], T] = new CanEqual[Set[A], T] { def areEqual(a: Set[A], b: T) = a == b } diff --git a/testkit/src/test/scala/org/apache/pekko/testkit/TestActorRefSpec.scala b/testkit/src/test/scala/org/apache/pekko/testkit/TestActorRefSpec.scala index 004dc16f46a..15cea977ca5 100644 --- a/testkit/src/test/scala/org/apache/pekko/testkit/TestActorRefSpec.scala +++ b/testkit/src/test/scala/org/apache/pekko/testkit/TestActorRefSpec.scala @@ -70,7 +70,7 @@ object TestActorRefSpec { case "work" => sender() ! "workDone" context.stop(self) - case replyTo: Promise[_] => replyTo.asInstanceOf[Promise[Any]].success("complexReply") + case replyTo: Promise[?] => replyTo.asInstanceOf[Promise[Any]].success("complexReply") case replyTo: ActorRef => replyTo ! "complexReply" } diff --git a/testkit/src/test/scala/org/apache/pekko/testkit/metrics/reporter/PekkoConsoleReporter.scala b/testkit/src/test/scala/org/apache/pekko/testkit/metrics/reporter/PekkoConsoleReporter.scala index 651985f0f44..148bc80336e 100644 --- a/testkit/src/test/scala/org/apache/pekko/testkit/metrics/reporter/PekkoConsoleReporter.scala +++ b/testkit/src/test/scala/org/apache/pekko/testkit/metrics/reporter/PekkoConsoleReporter.scala @@ -36,7 +36,7 @@ class PekkoConsoleReporter(registry: PekkoMetricRegistry, verbose: Boolean, outp private final val ConsoleWidth = 80 override def report( - gauges: util.SortedMap[String, Gauge[_]], + gauges: util.SortedMap[String, Gauge[?]], counters: util.SortedMap[String, Counter], histograms: util.SortedMap[String, Histogram], meters: util.SortedMap[String, Meter], @@ -82,7 +82,7 @@ class PekkoConsoleReporter(registry: PekkoMetricRegistry, verbose: Boolean, outp output.print(" count = %d%n".format(entry.getCount)) } - private def printGauge(entry: Gauge[_]): Unit = { + private def printGauge(entry: Gauge[?]): Unit = { output.print(" value = %s%n".format(entry.getValue)) } @@ -168,7 +168,7 @@ class PekkoConsoleReporter(registry: PekkoMetricRegistry, verbose: Boolean, outp } /** Required for getting simple names of refined instances */ - private def simpleName(clazz: Class[_]): String = { + private def simpleName(clazz: Class[?]): String = { val n = clazz.getName val i = n.lastIndexOf('.') n.substring(i + 1)