You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
inline class Identifier(val value: String)
data class FormInstance(
var formId: Identifier,
var createdAt: Date = Date(),
var modifiedAt: Date = Date(),
var fieldValues: HashMap<Identifier, String> = hashMapOf()
)
So the problem is that the Identifier gets it value when its parsed itself, but when parsing the hashmap, it uses the following code: (screenshot line 207)
I think the code needs to check for inline classes if this is possible, because these are experimental in kotlin 1.3, and the library is written in java.
The text was updated successfully, but these errors were encountered:
I don't believe Gson should support Kotlin or its experimental features. It's probably a design problem that the Map type adapter uses static String.valueOf instead of a key-to-string strategy (and not rejecting non-String-keyed maps), but I would consider implementing a FormInstance to FormInstanceDto (having a map with true String keys, not inline classes) converter and vice versa.
You can write a TypeAdapter which unwraps the class yourself or just override toString() and write out the wrapped property value. Gson won't be seeing updates for Kotlin.
I am using the following code:
And the result is serialized as:
So the problem is that the Identifier gets it value when its parsed itself, but when parsing the hashmap, it uses the following code: (screenshot line 207)
I think the code needs to check for inline classes if this is possible, because these are experimental in kotlin 1.3, and the library is written in java.
The text was updated successfully, but these errors were encountered: