Sunday, 1 September 2013

Java compiler error "type parameter xxx.ecom.process.profile.offers.OfferEnriched is not within its bound"

Java compiler error "type parameter
xxx.ecom.process.profile.offers.OfferEnriched is not within its bound"

I have 2 related questions:
Codefor question 1:
1 private List<OfferEnriched> sortedByDate(List<OfferEnriched> offers) {
2 Collections.sort(offers, new Comparator<OfferEnriched>() {
3 @Override
4 public int compare(OfferEnriched offer1, OfferEnriched offer2) {
5 return offer1.getExDate().compareTo(offer2.getExDate());
6 }
7 });
8 return offers;
9 }
Question 1: The error "type parameter
xxx.ecom.process.profile.offers.OfferEnriched is not within its bound" is
pointed at line 1 and 2 above. What is the problem?
Quetiosn 2: Also at the call of the method I get error: "cannot access
xxx.ecom.process.profile.offers.Offer. class file for
xxx.ecom.process.profile.offers.Offer not found". Why does the compiler
look for Offer in xxx.ecom.process.profile.offers package? See code below.
Code for question 2:
List<OfferEnriched> offers =
sortedByDate(getOffersHelper().enrichAllOffers(userContext,
getOffersAdapter().getOffers(market, emailAddr),
channelsWeCareAbout));
Error is pointed at above statement. OffersHelper class is in package
xxx.ecom.process.profile.helper and its enrichAllOffers method has
following signature:
public List<OfferEnriched> enrichAllOffers(UserContext userContext,
List<Offer> offers,
Collection<ChannelType> channelsWeCareAbout)
where Offer is in package xxx.profile.common.offers
Any help will be appreciated. Raj

No comments:

Post a Comment