-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kotlin var does not save generic type (deserialized to LinkedTreeMap instead) #1101
Comments
I have run
The |
Yes, I have same problem, but this issue reproduce only in some devices |
yep, you probably want |
Yes, looks like annotating the data class BigClass(var inBig: Map<String, @JvmSuppressWildcards List<SmallClass>>? = null) |
Also, when using Jackson, it works just fine without an annotation. |
I have done some more research and it seems like Kotlin is not at fault. Gson fails with the same exception for the following Java class (which is similar to the Kotlin one in the issue description): class BigClass {
Map<String, ? extends List<SmallClass>> inBig;
}
// ...
class SmallClass {
String inSmall;
} |
Closed in favor of #1107. |
after adding in data class
|
as not worked so and not works, why the problem is considered solved? @egor-n |
@abbath0767 this is a duplicate of #1107. |
Executing the code above will lead to the following Exception:
The
List<SmallClass>
is actually deserialized toList<LinkedTreeMap>
.However, if I changed the definition of
inBig
variable to be a constant, then it deserializes just fine:I changed
var
toval
and the code prints "hello" as expected.Kotlin 1.1.1 and Gson 2.8.1.
The text was updated successfully, but these errors were encountered: