The method getRecommendedIds(String, Object&Comparable<?>&Serializable[]) is ambiguous for the type MyService
尝试调用使用泛型和可变参数的重载方法时出现编译错误。
服务:
public interface MyService {
public <K> List<K> getRecommendedIds(String datasource, K... ids);
public <K> List<K> getRecommendedIds(String datasource, int limit, K... ids);
}
来电:
@Test(expected = NullPointerException.class)
public void testGetWithLimitThrowsNpeForNullDatasource() {
service.getRecommendedIds(null, 3, UUID.randomUUID());
}
有没有办法解决?