给定这个原型:
public static <C extends SetComposite, S extends Iterable<U>, U> boolean
eligibleForInclusion(C me, Class<C> clazz, List<S> members) throws TypeCollisionException {
...
}
这个呼叫站点:
public void include(RestaurantSet member) {
if (SetCompositeUtils.<RestaurantSetComposite, RestaurantSet, Restaurant>
eligibleForInclusion(this, this.getClass(), Arrays.asList(member))) {
inc.add(member);
}
}
Eclipse 编译器给出了这个错误:
The parameterized method <RestaurantSetComposite, RestaurantSet, Restaurant>eligibleForInclusion(RestaurantSetComposite, Class<RestaurantSetComposite>, List<RestaurantSet>) of type SetCompositeUtils is not applicable for the arguments (RestaurantSetComposite, Class<capture#1-of ? extends RestaurantSetComposite>, List<RestaurantSet>)
如果我没看错,Class<capture#1-of ? extends RestaurantSetComposite>
就是不匹配Class<RestaurantSetComposite>
。我能以某种方式解决这个问题吗?