我正在跟随 akka-in-action 教程学习,在第二章中,有一个类 (https://github.com/RayRoestenburg/akka-in-action/blob/master/chapter2/src/main/scala/com/goticks/RestInterface.scala):
trait RestApi extends HttpService with ActorLogging { actor: Actor =>
import context.dispatcher
import com.goticks.TicketProtocol._
...
import context.dispatcher
从未被使用,但它被定义了注释:
/**
* Returns the dispatcher (MessageDispatcher) that is used for this Actor.
* Importing this member will place an implicit ExecutionContext in scope.
*/
implicit def dispatcher: ExecutionContextExecutor
然而,IntelliJ一直将该导入标记为“未使用”,并在“优化导入”时删除它,导致错误value pipeTo is not a member of scala.concurrent.Future[Any]
。
有没有办法告诉IntelliJ这个导入不打算被“使用”,而仅仅是提供一个上下文呢?
或者教程应该更新以不使用这样的“未使用的导入”吗?