404-not-find / orika

Automatically exported from code.google.com/p/orika
2 stars 0 forks source link

Generic type information is lost #158

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.Create generic type which has fiels which is a List of class which is also a 
generic type but parameter is the same as parent class' e.g

////////////////////////////////////////////////////////////////////
public class ARootClass<STATE> {
    private List<AListClass<STATE>> facets;

    public List<AListClass<STATE>> getFacets() {
        return facets;
    }

    public void setFacets(final List<AListClass<STATE>> facets) {
        this.facets = facets;
    }
}

public class AListClass<STATE> {

    private String testString;
    private STATE genericObj;

    public STATE getGenericObj() {
        return genericObj;
    }

    public void setGenericObj(STATE genericObj) {
        this.genericObj = genericObj;
    }

    public String getTestString() {
        return testString;
    }

    public void setTestString(String testString) {
        this.testString = testString;
    }
}

////////////////////////////////////////////////////////////////////

2.Create similar class for mapping - e.g. BRootClass<STATE> and 
BListClass<STATE>. Field names leave the same to make no confusion.

////////////////////////////////////////////////////////////////////
public class BRootClass<STATE> {
    private List<BListClass<STATE>> facets;

    public List<BListClass<STATE>> getFacets() {
        return facets;
    }

    public void setFacets(final List<BListClass<STATE>> facets) {
        this.facets = facets;
    }
}

public class BListClass<STATE> {

    private String testString;
    private STATE genericObj;

    public STATE getGenericObj() {
        return genericObj;
    }

    public void setGenericObj(STATE genericObj) {
        this.genericObj = genericObj;
    }

    public String getTestString() {
        return testString;
    }

    public void setTestString(String testString) {
        this.testString = testString;
    }
}

////////////////////////////////////////////////////////////////////

3. Map instances

What is the expected output? What do you see instead?
Expected: mapped BRootClass<BGenericType>.facets.genericObj which is type of 
BGenericType

Instead: BRootClass<BGenericType>.facets.genericObj is type of Object - orika 
is loosing generic type information somewhere

What version of the product are you using? On what operating system?
Orika 1.4.6-SNAPSHOT

Test case sources included

Original issue reported on code.google.com by diegomar...@gmail.com on 25 Apr 2014 at 9:19

Attachments: