Skip to content

Commit

Permalink
=doc akka#16198 FSM extends Actor, not depends on it
Browse files Browse the repository at this point in the history
The documentation incorrectly stated that FSM uses self type references
to depend on Actor, but it’s false, FSM directly extends Actor.
  • Loading branch information
kosii committed Nov 3, 2014
1 parent dd76120 commit 324dc0f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
8 changes: 4 additions & 4 deletions akka-docs/rst/scala/code/docs/actor/FSMDocSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class FSMDocSpec extends MyFavoriteTestFrameWorkPlusAkkaTestKit {
final case class Todo(target: ActorRef, queue: immutable.Seq[Any]) extends Data
//#simple-state
//#simple-fsm
class Buncher extends Actor with FSM[State, Data] {
class Buncher extends FSM[State, Data] {

//#fsm-body
startWith(Idle, Uninitialized)
Expand Down Expand Up @@ -91,7 +91,7 @@ class FSMDocSpec extends MyFavoriteTestFrameWorkPlusAkkaTestKit {
case object Idle extends StateType
case object Active extends StateType

class Dummy extends Actor with FSM[StateType, Int] {
class Dummy extends FSM[StateType, Int] {
class X
val newData = 42
object WillDo
Expand Down Expand Up @@ -171,7 +171,7 @@ class FSMDocSpec extends MyFavoriteTestFrameWorkPlusAkkaTestKit {

//#logging-fsm
import akka.actor.LoggingFSM
class MyFSM extends Actor with LoggingFSM[StateType, Data] {
class MyFSM extends LoggingFSM[StateType, Data] {
//#body-elided
override def logDepth = 12
onTermination {
Expand All @@ -191,7 +191,7 @@ class FSMDocSpec extends MyFavoriteTestFrameWorkPlusAkkaTestKit {
"simple finite state machine" must {

"demonstrate NullFunction" in {
class A extends Actor with FSM[Int, Null] {
class A extends FSM[Int, Null] {
val SomeState = 0
//#NullFunction
when(SomeState)(FSM.NullFunction)
Expand Down
5 changes: 2 additions & 3 deletions akka-docs/rst/scala/fsm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,8 @@ Reference
The FSM Trait and Object
------------------------

The :class:`FSM` trait may only be mixed into an :class:`Actor`. Instead of
extending :class:`Actor`, the self type approach was chosen in order to make it
obvious that an actor is actually created:
The :class:`FSM` trait inherits directly from :class:`Actor`, when you
extend :class:`FSM` you must be aware that an actor is actually created:

.. includecode:: code/docs/actor/FSMDocSpec.scala
:include: simple-fsm
Expand Down

0 comments on commit 324dc0f

Please sign in to comment.