mir*_*lon 7 scala intellij-idea akka executioncontext
我正在关注akka-in-action教程,在第2章中,有一个类(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._
...
Run Code Online (Sandbox Code Playgroud)
在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
Run Code Online (Sandbox Code Playgroud)
但是,IntelliJ会将导入标记为"未使用",并在"优化导入"时将其删除,从而导致错误value pipeTo is not a member of scala.concurrent.Future[Any].
有没有办法告诉IntelliJ这个导入不打算"使用",而只是简单地提供一个上下文?
或者是否应该更新教程以不使用这种"未使用的导入"?
| 归档时间: |
|
| 查看次数: |
2228 次 |
| 最近记录: |