-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
scala.collection.immutable.ListMap
fails to serialize since 2.9.3
#2422
Comments
Hmmh. This exception actually sounds familiar -- there was tightening in resolution code in // line 471:
private String _resolveTypePlaceholders(JavaType sourceType, JavaType actualType)
throws IllegalArgumentException
{
....
// 14-May-2018, tatu: As per [databind#2034] it seems we better relax assignment
// rules further -- at least likely "raw" (untyped, non-generic) base should probably
// allow specialization.
if (exp.hasRawClass(Object.class)) {
continue;
}
// 19-Apr-2018, tatu: Hack for [databind#1964] -- allow type demotion
// for `java.util.Map` key type if (and only if) target type is
// `java.lang.Object`
if (i == 0) {
if (sourceType.hasRawClass(Map.class)
&& act.hasRawClass(Object.class)) {
continue;
}
} but, alas, Scala's However, the first check (added in 2.9.6) would seem like that should avoid the problem. |
One significant challenge is that of reproduction: test in But if a test could be added to Scala module (for 2.9 branch ideally), I could add a tentative fix in databind, and we could verify fix for 2.9.10? |
scala.collection.immutable.ListMap
fails to serialize since 2.9.3
@dejanlokar1 I changed code in |
@cowtowncoder that is great. I will try it out after vacation at the start of September. |
@dejanlokar1 sounds good Have a nice vacation! |
@cowtowncoder I tested the change and it works as expected. |
Thank you again for verification. |
Quick note: will be in 2.10.0, but no current plans to backport into 2.9 due to minor (but non-null) risk of regression. |
Serializing a class with a property of type scala.collection.immutable.ListMap fails with a JsonMappingException. Serializing a ListMap as a root value works as expected. Other scala.collection.immutable.Map implementations also work. The last working version is 2.9.2. Issue is reproduced here.
This may be related to #2111 and #2080. Currently, we are setting serialization typing to static as a workaround.
The text was updated successfully, but these errors were encountered: