diff options
-rw-r--r-- | src/actors/scala/actors/ActorTask.scala | 13 | ||||
-rw-r--r-- | src/actors/scala/actors/ReplyReactorTask.scala | 13 |
2 files changed, 20 insertions, 6 deletions
diff --git a/src/actors/scala/actors/ActorTask.scala b/src/actors/scala/actors/ActorTask.scala index 8d0379c095..090d0448f0 100644 --- a/src/actors/scala/actors/ActorTask.scala +++ b/src/actors/scala/actors/ActorTask.scala @@ -12,12 +12,16 @@ package scala.actors /** * @author Philipp Haller + * @note This class inherits a public var called 'msg' from ReactorTask, + * and also defines a constructor parameter which shadows it (which makes any + * changes to the underlying var invisible.) I can't figure out what's supposed + * to happen, so I renamed the constructor parameter to at least be less confusing. */ private[actors] class ActorTask(actor: Actor, fun: () => Unit, handler: PartialFunction[Any, Any], - msg: Any) - extends ReplyReactorTask(actor, fun, handler, msg) { + initialMsg: Any) + extends ReplyReactorTask(actor, fun, handler, initialMsg) { protected override def beginExecution() { super.beginExecution() @@ -31,8 +35,11 @@ private[actors] class ActorTask(actor: Actor, val senderInfo = try { Some(actor.sender) } catch { case _: Exception => None } + // !!! If this is supposed to be setting the current contents of the + // inherited mutable var rather than always the value given in the constructor, + // then it should be changed from initialMsg to msg. val uncaught = UncaughtException(actor, - if (msg != null) Some(msg) else None, + if (initialMsg != null) Some(initialMsg) else None, senderInfo, Thread.currentThread, e) diff --git a/src/actors/scala/actors/ReplyReactorTask.scala b/src/actors/scala/actors/ReplyReactorTask.scala index 1db722f89b..cb63d7e000 100644 --- a/src/actors/scala/actors/ReplyReactorTask.scala +++ b/src/actors/scala/actors/ReplyReactorTask.scala @@ -12,18 +12,25 @@ package scala.actors /** * @author Philipp Haller + * @note This class inherits a public var called 'reactor' from ReactorTask, + * and also defines a constructor parameter which shadows it (which makes any + * changes to the underlying var invisible.) I can't figure out what's supposed + * to happen, so I renamed the constructor parameter to at least be less confusing. */ -private[actors] class ReplyReactorTask(reactor: ReplyReactor, +private[actors] class ReplyReactorTask(replyReactor: ReplyReactor, fun: () => Unit, handler: PartialFunction[Any, Any], msg: Any) - extends ReactorTask(reactor, fun, handler, msg) { + extends ReactorTask(replyReactor, fun, handler, msg) { var saved: ReplyReactor = _ protected override def beginExecution() { saved = Actor.tl.get - Actor.tl set reactor + // !!! If this is supposed to be setting the current contents of the + // inherited mutable var rather than always the value given in the constructor, + // then it should be changed to "set reactor". + Actor.tl set replyReactor } protected override def suspendExecution() { |