actor: allow seamless access to untyped extensions given typed ActorSystem (#28294)

* actor: allow seamless access to untyped extensions given typed ActorSystem

* add overrides with concrete type for Java API everywhere
This commit is contained in:
Johannes Rudolph 2019-12-05 16:01:23 +01:00 committed by Arnout Engelen
parent 2c96a57d89
commit 702b6a7f41
70 changed files with 192 additions and 49 deletions

View file

@ -0,0 +1,6 @@
# Incompatibilities against Akka < 2.5.17 where extra static bridge methods were generated that
# Mima now wrongly correlates with the new ones added in the PR
ProblemFilters.exclude[IncompatibleResultTypeProblem]("akka.persistence.fsm.SnapshotAfter.get")
ProblemFilters.exclude[IncompatibleResultTypeProblem]("akka.persistence.Persistence.get")
ProblemFilters.exclude[IncompatibleResultTypeProblem]("akka.persistence.journal.PersistencePluginProxyExtension.get")

View file

@ -158,6 +158,8 @@ object Persistence extends ExtensionId[Persistence] with ExtensionIdProvider {
/** Java API. */
override def get(system: ActorSystem): Persistence = super.get(system)
override def get(system: ClassicActorSystemProvider): Persistence = super.get(system)
def createExtension(system: ExtendedActorSystem): Persistence = new Persistence(system)
def lookup() = Persistence

View file

@ -24,6 +24,8 @@ import scala.reflect.ClassTag
private[akka] object SnapshotAfter extends ExtensionId[SnapshotAfter] with ExtensionIdProvider {
override def get(system: ActorSystem): SnapshotAfter = super.get(system)
override def get(system: ClassicActorSystemProvider): SnapshotAfter = super.get(system)
override def lookup = SnapshotAfter
override def createExtension(system: ExtendedActorSystem): SnapshotAfter = new SnapshotAfter(system.settings.config)

View file

@ -68,6 +68,7 @@ object PersistencePluginProxyExtension
new PersistencePluginProxyExtensionImpl(system)
override def lookup(): ExtensionId[_ <: Extension] = PersistencePluginProxyExtension
override def get(system: ActorSystem): PersistencePluginProxyExtensionImpl = super.get(system)
override def get(system: ClassicActorSystemProvider): PersistencePluginProxyExtensionImpl = super.get(system)
}
final class PersistencePluginProxy(config: Config) extends Actor with Stash with ActorLogging {

View file

@ -82,6 +82,7 @@ object JournalPuppet extends ExtensionId[JournalProbe] with ExtensionIdProvider
new JournalProbe()(system)
override def get(system: ActorSystem): JournalProbe = super.get(system)
override def get(system: ClassicActorSystemProvider): JournalProbe = super.get(system)
}
class JournalProbe(implicit private val system: ExtendedActorSystem) extends Extension {
val probe = TestProbe()