scala - 无法解析重载的方法映射 Scala 2.10.12/Intellij 2019.2.2
问题描述
def saveOffsetRanges(offsetRanges: ListBuffer[OffsetRange], consumer: String): Unit = {
println(s"offsets to redis${offsetRanges}")
val client = JedisUtil.getClient()
val map = offsetRanges
.groupBy(_.topic)
.map{ // errors found : cannot resolve overloaded method
case (topic , offsets) =>
val partitionToOffset = offsets.map(info => {
info.partition.toString() -> info.untilOffset.toString
})
Serialization.write(partitionToOffset)
}
client.close()
}
发现想法错误:无法解析重载方法'map',但'map'在scala中很常见。我确信代码是正确的。
然后我尝试使缓存无效并重新启动(IDEA -> File -> Invalide Caches/Restart)。问题仍然存在,其他“地图”也无法解决,在我操作之前,其他“地图”没问题。
def getOffsets(consumer: String) = {
val client = JedisUtil.getClient()
client.hgetAll(s"offset_$consumer")
.asScala
.map{// errors found : cannot resolve overloaded method
case (partition,offset) =>
val tp = new TopicPartition(partition.toInt)
val o = offset.toLong
tp->o
}
}
它真的是连线的,代码可以工作,但错误会影响编码(想法不要自动提示方法和类型)
解决方案
推荐阅读
- amazon-web-services - 配置 AWS API Gateway 的日志记录
- python - 解决 Python 中的包名冲突
- mysql - bash 脚本中 mysql 命令的问题
- ios - 照片错误是什么意思:无法获取资产 XPC 代理
- django - 如何将数据从回调传输到 Django 中的另一个视图?
- azure - Azure Red Hat OpenShift 群集的清理 URL
- ruby-on-rails - NoMethodError:RSpec 中 nil:NilClass 的未定义方法“customer_details”
- google-ad-manager - 我如何将项目状态从准备好更改为正在交付?
- angular - 指令上的角度动画
- terraform - 0.12upgrade 命令后的 terraform 配置不正确