我有两个相关的问题:
问题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 }
问题一:错误“type parameter xxx.ecom.process.profile.offers.OfferEnriched is not within its bound”指向上面第1行和第2行。问题是什么?
Quetiosn 2:在调用该方法时,我也收到错误消息:“无法访问 xxx.ecom.process.profile.offers.Offer. xxx.ecom.process.profile.offers.Offer 的类文件未找到”。为什么编译器会在 xxx.ecom.process.profile.offers 包中查找 Offer?请参阅下面的代码。
问题2的代码:
List<OfferEnriched> offers =
sortedByDate(getOffersHelper().enrichAllOffers(userContext,
getOffersAdapter().getOffers(market, emailAddr), channelsWeCareAbout));
错误指向上面的语句。OffersHelper 类在包 xxx.ecom.process.profile.helper 中,它的enrichAllOffers 方法具有以下签名:
public List<OfferEnriched> enrichAllOffers(UserContext userContext, List<Offer> offers,
Collection<ChannelType> channelsWeCareAbout)
Offer 在包 xxx.profile.common.offers 中
任何帮助将不胜感激。拉吉