Generic wildcard types are not supported

Viewed 611

I'm getting the following error:

Could not deserialize object. Generic wildcard types are not supported (found in field m1(Map<String,Any>).someStringInM1(String))

This error is generated by the following line (I'm using Firestore's Android SDK):

task.result.toObjects(SomeClass::class.java)

In which I'm trying to map the result to a list of a Custom Class which has the following constructor:

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
    }
1 Answers

In the release notes for the Firebase SDKs, it mentions for version 11.6.0:

Feature: Added support for deserializing field types with wildcard generic parameters (e.g. kotlin.Map).

Sounds like you should just upgrade your client library to 11.6.0.

Related