improve safety of Props.create by allowing Creator<T>, see #3377

Props constructors need to be deprecated instead of being mutated
because we cannot just start throwing exceptions in people’s existing
code. Props.withCreator is deprecated for similar reasons, but also
because Props are about the creators, so replacing that after the fact
is not good style.
This commit is contained in:
Roland 2013-05-28 10:39:38 +02:00
parent 58756be937
commit f8fa825e48
11 changed files with 222 additions and 45 deletions

View file

@ -243,19 +243,19 @@ class ActorDocSpec extends AkkaSpec(Map("akka.loglevel" -> "INFO")) {
//#creating-props
//#creating-props-deprecated
// DEPRECATED: encourages to close over enclosing class
// DEPRECATED: old case class signature
val props4 = Props(
creator = { () new MyActor },
dispatcher = "my-dispatcher")
// DEPRECATED: encourages to close over enclosing class
// DEPRECATED due to duplicate functionality with Props.apply()
val props5 = props1.withCreator(new MyActor)
// DEPRECATED: encourages to close over enclosing class
val props6 = Props(new MyActor)
// DEPRECATED due to duplicate functionality with Props.apply()
val props7 = props1.withCreator(classOf[MyActor])
val props6 = props1.withCreator(classOf[MyActor])
// NOT RECOMMENDED: encourages to close over enclosing class
val props7 = Props(new MyActor)
//#creating-props-deprecated
}