Arsen Alexanyan
Arsen Alexanyan

Reputation: 3141

Ambiguous method call intelliJ 15

I have two overloaded methods:

protected final <L extends List<D>> ResponseEntity<L> convertAndRespond(final Iterable<E> sources, final Class<L> dataListClass) { ... }

protected final <L extends List<D>> ResponseEntity<L> convertAndRespond(final Page<E> sources, final Class<L> dataListClass) { ... }

where interface Page<T> implements Iterable<T>

I have method which finally creates page object and returns the following method call:

convertAndRespond(page, A.class);

IntelliJ gives me here compile error: Ambiguous method call Although my application builds & runs pretty well. What could be the issue?

The interesting thing here is that previously IntelliJ 14 were not showing there any compilation problems.

Upvotes: 2

Views: 802

Answers (1)

stdunbar
stdunbar

Reputation: 17535

IntelliJ is telling you that the compiler could pick either method to run. After all, the class Page is a Iterable.

This may be dependent on the compiler you've chosen for IntelliJ but either way, it is a bug waiting to happen.

Upvotes: 1

Related Questions