Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Type Mismatch

dadams07Jul 11 2014 — edited Jul 22 2014

I have a class defined as follows:

public class MultiFacilitySearchDataProvider <T extends Facility & MilepostValue & Copyable<T>>

The class has this method:

protected T getFacility(final FacilityInstance instance) {

    final MultiFacilitySearchDAO dao = new MultiFacilitySearchDAO(instance);

    ENM.execute(dao);

   return dao.getResultModel();  // Compile error here

}

The DAO method called above looks like this:

public MultiFacilitySearchModel getResultModel() {

    return resultModel;

}

And MultiFacilitySearchModel is defined as follows:

public class MultiFacilitySearchModel implements Copyable<MultiFacilitySearchModel>, Facility,

     Serializable, MilepostValue, MenuDisplayValues

The problem is that the line return dao.getResultModel() generates a compile error "Type mismatch: cannot convert from MultiFacilitySearchModel to T". I don't understand why I'm getting this error, since MultiFacilitySearchModel implements the three interfaces specified for the generic type T. What am I missing?

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 19 2014
Added on Jul 11 2014
1 comment
1,332 views