#237 bug in TypeResolver with generics / inheritance

Dozer v5.3.0

I think there's a bug in TypeResolver when it tries to resolve and cache the generic type of a read method for a mapped class (C) that inherits from an intermediate class (B) which itself inherits from a parent base class (A), eg:

abstract class A<ID extends Serializable>

ID getId()
setId(ID id)

abstract class B<ID extends Serializable> extends A<ID>

class C extends B<Long>

The generic type that will be cached by TypeResolver is ID of class B but the lookup will be made on ID of class A ! Since there are different TypeResolver will simple return null and the mapping will crash at runtime with a ClassCastException...

With only 1 level of inheritance (remove B in my example) it works !

I think the problem lies in the fact that the types are cached in a map keyed by their parameter. Like in my case I have ID multiple times but for Dozer they all should be equal, of course for Java their not!




  • dmitry (lv)

    dmitry (lv) - 2010-01-02

    Vadim - could you please investigate how difficult is to fix this

  • dmitry (lv)

    dmitry (lv) - 2010-01-02
    • labels: --> Mapping Issue
    • milestone: 898417 --> 929386
    • assigned_to: nobody --> vadeg
  • Vadim Shaigorodskiy

    • status: open --> open-fixed
  • Vadim Shaigorodskiy

    Bug was found and fixed. Appropriate test added.

  • dmitry (lv)

    dmitry (lv) - 2010-08-12
    • milestone: 929386 --> Dozer v5.3.0
    • status: open-fixed --> closed-fixed
  • dmitry (lv)

    dmitry (lv) - 2010-08-12

    Seems to be fixed. Will be released in 5.3


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks