【发布时间】:2019-04-02 03:48:50
【问题描述】:
我是 scala 和 IntelliJ 的新手,所以这听起来像是一个愚蠢的问题。但是,我看到在调试时,IntelliJ 会将参数类型推断为某种“奇怪”类型,在我的情况下为 MapLike$MappedValues。预期类型为Map[String, Iterable[Person]]。
为什么 IntelliJ 不能显示正确的类型?现在这对我来说很重要,因为通过调试我试图找出正确的参数类型,因为这部分的 API 文档不是很清楚(使用 Apache Flink CEP)
代码示例:
val result:DataStream[String] = patternStream.select(patterns => {
val person:Person = patterns.head._2.head
s"Person ${person.name} of age ${person.age} can drink!"
})
根据documentation:
“select() 方法以一个选择函数作为参数,为每个匹配的事件序列调用该函数。它以 Map[String,可迭代[IN]]"
为什么 IntelliJ 显示 MapLike$MappedValues 而不是 Map[String,Iterable[Person]] 之类的东西?
【问题讨论】:
标签: scala class debugging intellij-idea