scala - Scala Async 和 Wartrremover
问题描述
我想使用scala-async。我还使用启用了 [Return] 的 Wartrremover。(http://www.wartremover.org/doc/warts.html#return)。
然后我添加了一些代码来测试它:
async {
val studentsCount = await(studentsDao.getStudents())
val externalStudentsCount = await(studentsDao.getExternalStudents())
externalStudentsCount + studentsCount
}
当我尝试编译它时,它给了我错误:
[wartremover:Return] return is disabled
有什么方法可以将 Wartremover 与 scala-async 一起使用?
解决方案
似乎async
宏在幕后生成return
语句。
您可以通过在块@SuppressWarnings(Array("org.wartremover.warts.Return"))
上方添加来解决它。async
推荐阅读
- c++ - 使用 () 或 {} 作为初始值设定项列表有什么区别
- java - 使用 Java 从 MySQL 检索 TIMESTAMP 发生在前一小时
- audio - PIC32MX:SPI1CON.SPIBUSY 位永远不会被清除
- java - 可聚焦时编辑文本视图 setError()
- java - Spring Boot 控制器对象中的 NullPointerException 错误
- sql - 实体框架快照的缺点
- c# - WPF 错误:40:BindingExpression 路径错误:使用正确的绑定
- typescript - 你能在类型声明中得到准确的当前索引键吗?
- c++ - C++ 中父进程 ID 的父进程
- vba - 在 MS Word 2016 中选择和重新定位和图像