Situation: A bean with a Map<String,Object>. The Map contains objects of various types, including an ArrayList.
Result: All values mapped after the ArrayList has been mapped are incorrectly converted to java.lang.String
Expected Result: All values are mapped 1:1 to their original type, including the ArrayList.
Analysis: The ArrayList object in the Map causes mapCollection() to set a destination type hint into the FieldMap. It uses java.lang.String (taken from the Map's generic type of the key?!?!) as the hint. The same FieldMap is then used for the rest of the entries in the Map. All the entries are converted to Strings.
Test case attached.
JUnit test case for reproducing the problem with current Dozer 5.2.2 release
Thank you for exceptionally good test case, this helped a lot!
This was solved by cloning field map instead of replacing global instance.