shau-lok / google-gson

Automatically exported from code.google.com/p/google-gson
0 stars 0 forks source link

Serializing a class that aggregates a map with variable type values fails. #304

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When I serialize a Map<String, IChild> where IChild can be of type ChildA or 
ChildB then Gson works correctly without a custom serializer.

When I aggregate this map into some other object "Root" and I serialize the 
Root object, then the map is no longer correctly serialized.

I included a JUnit4 test that exposes the problem...

This is an annoying bug since I wanted to use GSON to avoid needing to write 
too many unittests on the serialisation part of my code.

I don't need to deserialize the output that is done in the browser with GWT 
JavaScriptObject overlays.

Original issue reported on code.google.com by david.nouls on 24 Mar 2011 at 10:17

Attachments:

GoogleCodeExporter commented 9 years ago
Is anybody actually looking at issues in the team ? 

Original comment by david.nouls on 30 Mar 2011 at 11:29

GoogleCodeExporter commented 9 years ago
I'll make sure this gets looked at before our 1.7 release. Have you been able 
to reproduce the problem on GSON 1.7 ?

Original comment by limpbizkit on 30 Mar 2011 at 2:41

GoogleCodeExporter commented 9 years ago
I don't have aa 1.7 release, so I can not double check.
But this issue report contains a straightforward junit4 test, if it runs 
without error with the cirrent 1.7 then consider it fixed.

Original comment by david.nouls on 30 Mar 2011 at 3:16

GoogleCodeExporter commented 9 years ago
I tried my unittest with 1.7 and it fixes the bug.
Thanks for the fast release!

Original comment by david.nouls on 13 Apr 2011 at 6:38

GoogleCodeExporter commented 9 years ago

Original comment by joel.leitch@gmail.com on 13 Apr 2011 at 9:04

GoogleCodeExporter commented 9 years ago
this bug is fixed, but I have the same issue with Lists.

Original comment by david.nouls on 1 Jun 2011 at 2:09