Menu

#337 Multiple superclass mappings, fields mapped over and over.

Dozer v5.3.3
closed-fixed
9
2011-10-09
2011-08-03
Anonymous
No

When classes being mapped have multiple super classes, super mappings are processed multiple times.

So if you have:

class TestClassA extends SuperClassA1{...}
class SuperClassA1 extends SuperClassA{...}
..and..
class TestClassB extends SuperClassB1{...}
class SuperClassB1 extends SuperClassB{...}

and mappings like so:
<mapping>
<class-a>TestClassA</class-a>
<class-b>TestClassB</class-b>
</mapping>

<mapping>
<class-a>SuperClassA</class-a>
<class-b>SuperClassB</class-b>
</mapping>
<mapping>
<class-a>SuperClassA1</class-a>
<class-b>SuperClassB1</class-b>
</mapping>

and do:
TestClassA a = new TestClassA();
dozerBeanMapper.map(a,TestClassB.class);

The fields defined in SuperClassA will be mapped twice. This is especially apparent in collection cases as the final mapped class will have the amount of collection items doubled.

Failing test and all test classes are in the attached ZIP file.
Failing unit test and all test classes are attached in the zip.

Discussion

  • dmitry (lv)

    dmitry (lv) - 2011-10-09

    fixed in trunk

     
  • dmitry (lv)

    dmitry (lv) - 2011-10-09
    • milestone: 1331587 --> Dozer v5.3.3
    • assigned_to: nobody --> buzdin
    • status: open --> closed-fixed
     

Log in to post a comment.