From 8969ebc8f33d61f4ac3f9d00944a9cb79e75e7df Mon Sep 17 00:00:00 2001 From: Enno <458526+ennru@users.noreply.github.com> Date: Wed, 18 Mar 2020 08:04:31 +0100 Subject: [PATCH] Google Cloud Storage: add access with new actors API --- .../mima-filters/2.0.0-M3.backwards.excludes | 3 +++ .../googlecloud/storage/GCStorageExt.scala | 25 ++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/google-cloud-storage/src/main/mima-filters/2.0.0-M3.backwards.excludes b/google-cloud-storage/src/main/mima-filters/2.0.0-M3.backwards.excludes index 8ed10249e5..1f806f2c30 100644 --- a/google-cloud-storage/src/main/mima-filters/2.0.0-M3.backwards.excludes +++ b/google-cloud-storage/src/main/mima-filters/2.0.0-M3.backwards.excludes @@ -15,3 +15,6 @@ ProblemFilters.exclude[MissingClassProblem]("main.scala.*") ProblemFilters.exclude[IncompatibleSignatureProblem]("akka.stream.alpakka.googlecloud.storage.StorageObject.*") ProblemFilters.exclude[IncompatibleMethTypeProblem]("akka.stream.alpakka.googlecloud.storage.StorageObject.withCustomerEncryption") ProblemFilters.exclude[IncompatibleMethTypeProblem]("akka.stream.alpakka.googlecloud.storage.StorageObject.withOwner") + +# override of apply in extension with the concrete type instead of the generic type +ProblemFilters.exclude[IncompatibleResultTypeProblem]("akka.stream.alpakka.googlecloud.storage.GCStorageExt.apply") diff --git a/google-cloud-storage/src/main/scala/akka/stream/alpakka/googlecloud/storage/GCStorageExt.scala b/google-cloud-storage/src/main/scala/akka/stream/alpakka/googlecloud/storage/GCStorageExt.scala index 376e1c922c..3453fe20b0 100644 --- a/google-cloud-storage/src/main/scala/akka/stream/alpakka/googlecloud/storage/GCStorageExt.scala +++ b/google-cloud-storage/src/main/scala/akka/stream/alpakka/googlecloud/storage/GCStorageExt.scala @@ -4,7 +4,7 @@ package akka.stream.alpakka.googlecloud.storage -import akka.actor.{ActorSystem, ExtendedActorSystem, Extension, ExtensionId, ExtensionIdProvider} +import akka.actor.{ClassicActorSystemProvider, ExtendedActorSystem, Extension, ExtensionId, ExtensionIdProvider} /** * Manages one [[GCStorageSettings]] per `ActorSystem`. @@ -19,6 +19,25 @@ object GCStorageExt extends ExtensionId[GCStorageExt] with ExtensionIdProvider { override def lookup = GCStorageExt override def createExtension(system: ExtendedActorSystem) = new GCStorageExt(system) - /** Java API */ - override def get(system: ActorSystem): GCStorageExt = super.get(system) + /** + * Get the GCS extension with the classic actors API. + */ + override def apply(system: akka.actor.ActorSystem): GCStorageExt = super.apply(system) + + /** + * Get the GCS extension with the new actors API. + */ + def apply(system: ClassicActorSystemProvider): GCStorageExt = super.apply(system.classicSystem) + + /** + * Java API. + * Get the GCS extension with the classic actors API. + */ + override def get(system: akka.actor.ActorSystem): GCStorageExt = super.apply(system) + + /** + * Java API. + * Get the GCS extension with the new actors API. + */ + def get(system: ClassicActorSystemProvider): GCStorageExt = super.apply(system.classicSystem) }