=doc #16198 FSM extends Actor, not depends on it

The documentation incorrectly stated that FSM uses self type references
to depend on Actor, but it’s false, FSM directly extends Actor.
This commit is contained in:
Balázs Kossovics 2014-11-03 23:43:50 +01:00
parent dd76120376
commit 324dc0f0c5
2 changed files with 6 additions and 7 deletions

View file

@ -39,7 +39,7 @@ class FSMDocSpec extends MyFavoriteTestFrameWorkPlusAkkaTestKit {
final case class Todo(target: ActorRef, queue: immutable.Seq[Any]) extends Data final case class Todo(target: ActorRef, queue: immutable.Seq[Any]) extends Data
//#simple-state //#simple-state
//#simple-fsm //#simple-fsm
class Buncher extends Actor with FSM[State, Data] { class Buncher extends FSM[State, Data] {
//#fsm-body //#fsm-body
startWith(Idle, Uninitialized) startWith(Idle, Uninitialized)
@ -91,7 +91,7 @@ class FSMDocSpec extends MyFavoriteTestFrameWorkPlusAkkaTestKit {
case object Idle extends StateType case object Idle extends StateType
case object Active extends StateType case object Active extends StateType
class Dummy extends Actor with FSM[StateType, Int] { class Dummy extends FSM[StateType, Int] {
class X class X
val newData = 42 val newData = 42
object WillDo object WillDo
@ -171,7 +171,7 @@ class FSMDocSpec extends MyFavoriteTestFrameWorkPlusAkkaTestKit {
//#logging-fsm //#logging-fsm
import akka.actor.LoggingFSM import akka.actor.LoggingFSM
class MyFSM extends Actor with LoggingFSM[StateType, Data] { class MyFSM extends LoggingFSM[StateType, Data] {
//#body-elided //#body-elided
override def logDepth = 12 override def logDepth = 12
onTermination { onTermination {
@ -191,7 +191,7 @@ class FSMDocSpec extends MyFavoriteTestFrameWorkPlusAkkaTestKit {
"simple finite state machine" must { "simple finite state machine" must {
"demonstrate NullFunction" in { "demonstrate NullFunction" in {
class A extends Actor with FSM[Int, Null] { class A extends FSM[Int, Null] {
val SomeState = 0 val SomeState = 0
//#NullFunction //#NullFunction
when(SomeState)(FSM.NullFunction) when(SomeState)(FSM.NullFunction)

View file

@ -123,9 +123,8 @@ Reference
The FSM Trait and Object The FSM Trait and Object
------------------------ ------------------------
The :class:`FSM` trait may only be mixed into an :class:`Actor`. Instead of The :class:`FSM` trait inherits directly from :class:`Actor`, when you
extending :class:`Actor`, the self type approach was chosen in order to make it extend :class:`FSM` you must be aware that an actor is actually created:
obvious that an actor is actually created:
.. includecode:: code/docs/actor/FSMDocSpec.scala .. includecode:: code/docs/actor/FSMDocSpec.scala
:include: simple-fsm :include: simple-fsm