The method getRecommendedIds(String, Object&Comparable<?>&Serializable[]) is ambiguous for the type MyService
ジェネリックスとvarargsを使用するオーバーロードされたメソッドを呼び出そうとすると、コンパイルエラーが発生します。
サービス:
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());
}
これを回避する方法はありますか?