问题描述
我有此代码段,可与Kotlin 1.3.72
一起很好地工作:
import javax.persistence.EntityManager
val query = entityManager.createquery(...)
val myEnumToDate: MutableMap<EventTypeEnum,Date> = mutableMapOf()
query.resultStream
.map { it as Array<*> } // line 10
.map { Pair(it[0] as MyEnum,it[1] as Date) } // line 11
.forEachOrdered { (myEnum,date) -> // line 12
myEnumToDate.putIfAbsent(MyEnum,date) // line13
}
return myEnumToDate
更新到Kotlin 1.4.0-rc
后,出现以下编译错误,当使用Gradle进行编译时,IntelliJ还会在IDE中显示错误。
line 10: Not enough @R_125_4045@ion to infer type variable R
line 11: Not enough @R_125_4045@ion to infer type variable R
line 11: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public operator fun MatchGroupCollection.get(name: String): MatchGroup? defined in kotlin.text
line 11: No get method providing array access
line 11: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public operator fun MatchGroupCollection.get(name: String): MatchGroup? defined in kotlin.text
line 11: No get method providing array access
line 12: Destructuring declaration initializer of type Any! must have a 'component1()' function
line 12: Destructuring declaration initializer of type Any! must have a 'component2()' function
如何通过声明显式类型来解决它? 我认为这应该被报告为Kotlin类型干扰中的错误,对吧?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)