模糊方法调用intelliJ 15 [英] Ambiguous method call intelliJ 15
问题描述
我有两个重载方法:
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) { ... }
其中 interface Page< T>实现Iterable< T>
我有方法最终创建页面对象并返回以下方法调用:
I have method which finally creates page object and returns the following method call:
convertAndRespond(page, A.class);
IntelliJ在这里给我编译错误:模糊方法调用
虽然我的应用程序构建和运行得很好。可能是什么问题?
IntelliJ gives me here compile error: Ambiguous method call Although my application builds & runs pretty well. What could be the issue?
这里有趣的是,以前的IntelliJ 14没有显示任何编译问题。
推荐答案
IntelliJ告诉你编译器可以选择要运行的任一方法。毕竟,类Page 是 Iterable。
IntelliJ is telling you that the compiler could pick either method to run. After all, the class Page is a Iterable.
这可能取决于您为IntelliJ选择的编译器,但无论如何,它是一个等待发生的错误。
This may be dependent on the compiler you've chosen for IntelliJ but either way, it is a bug waiting to happen.
这篇关于模糊方法调用intelliJ 15的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!