不支持通用通配符类型
Generic wildcard types are not supported
我收到以下错误:
Could not deserialize object. Generic wildcard types are not supported (found in field m1(Map<String,Any>).someStringInM1(String)
)
此错误由以下行生成(我使用的是 Firestore 的 Android SDK):
task.result.toObjects(SomeClass::class.java)
我试图将结果映射到具有以下构造函数的自定义列表 Class:
constructor(s1: String, s2: String, d1: Double, m1: Map<String, Any>, dr1: DocumentReference, i1: Int, d2: Double) {
this.s1 = s1
this.s2 = s2
this.d1 = d1
this.m1 = m1
this.dr1 = dr1
this.i1 = i1
this.d2 = d2
}
在 Firebase SDK 的 release notes 中,它提到版本 11.6.0:
Feature: Added support for deserializing field types with wildcard generic parameters (e.g. kotlin.Map).
听起来您应该将客户端库升级到 11.6.0。
我收到以下错误:
Could not deserialize object. Generic wildcard types are not supported (found in field
m1(Map<String,Any>).someStringInM1(String)
)
此错误由以下行生成(我使用的是 Firestore 的 Android SDK):
task.result.toObjects(SomeClass::class.java)
我试图将结果映射到具有以下构造函数的自定义列表 Class:
constructor(s1: String, s2: String, d1: Double, m1: Map<String, Any>, dr1: DocumentReference, i1: Int, d2: Double) {
this.s1 = s1
this.s2 = s2
this.d1 = d1
this.m1 = m1
this.dr1 = dr1
this.i1 = i1
this.d2 = d2
}
在 Firebase SDK 的 release notes 中,它提到版本 11.6.0:
Feature: Added support for deserializing field types with wildcard generic parameters (e.g. kotlin.Map).
听起来您应该将客户端库升级到 11.6.0。