Skip to content

Commit

Permalink
[Backport] Make ClassicActorSystemProvider.classicSystem public API
Browse files Browse the repository at this point in the history
Backport of #28847
See #28818
  • Loading branch information
ennru committed Mar 31, 2020
1 parent 4e6e96b commit 2203f2b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ import com.github.ghik.silencer.silent
override def provider: ActorRefProvider = throw new UnsupportedOperationException("no provider")

// stream materialization etc. using stub not supported
override private[akka] def classicSystem =
override def classicSystem =
throw new UnsupportedOperationException("no classic actor system available")

// impl InternalRecipientRef
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import akka.event.LoggingFilterWithMarker

import ActorRefAdapter.sendSystemMessage

override private[akka] def classicSystem: untyped.ActorSystem = untypedSystem
override def classicSystem: untyped.ActorSystem = untypedSystem

// Members declared in akka.actor.typed.ActorRef
override def tell(msg: T): Unit = {
Expand Down Expand Up @@ -140,12 +140,5 @@ private[akka] object ActorSystemAdapter {
new LoadTypedExtensions(system)
}

def toClassic[U](sys: ActorSystem[_]): untyped.ActorSystem =
sys match {
case adapter: ActorSystemAdapter[_] => adapter.untypedSystem
case _ =>
throw new UnsupportedOperationException(
"only adapted untyped ActorSystem permissible " +
s"($sys of class ${sys.getClass.getName})")
}
def toClassic[U](sys: ActorSystem[_]): untyped.ActorSystem = sys.classicSystem
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ package object adapter {
implicit class TypedActorSystemOps(val sys: ActorSystem[_]) extends AnyVal {
@deprecated("Use 'toClassic' instead", "2.5.26")
def toUntyped: akka.actor.ActorSystem = toClassic
def toClassic: akka.actor.ActorSystem = ActorSystemAdapter.toClassic(sys)
def toClassic: akka.actor.ActorSystem = sys.classicSystem

/**
* INTERNAL API
Expand Down
2 changes: 1 addition & 1 deletion akka-actor/src/main/scala/akka/actor/ActorSystem.scala
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ private[akka] class ActorSystemImpl(
def /(actorName: String): ActorPath = guardian.path / actorName
def /(path: Iterable[String]): ActorPath = guardian.path / path

override private[akka] def classicSystem: ActorSystem = this
override def classicSystem: ActorSystem = this

// Used for ManifestInfo.checkSameVersion
private def allModules: List[String] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ import akka.annotation.InternalApi
@DoNotInherit
trait ClassicActorSystemProvider {

/** INTERNAL API */
@InternalApi
private[akka] def classicSystem: ActorSystem
/**
* Allows access to the classic `akka.actor.ActorSystem` even for `akka.actor.typed.ActorSystem[_]`s.
*/
def classicSystem: ActorSystem
}

/**
Expand Down

0 comments on commit 2203f2b

Please sign in to comment.