Questions tagged «ecj»

3
具有多个匹配目标类型的lambda表达式的方法签名选择
我正在回答一个问题,遇到了无法解释的情况。考虑以下代码: interface ConsumerOne<T> { void accept(T a); } interface CustomIterable<T> extends Iterable<T> { void forEach(ConsumerOne<? super T> c); //overload } class A { private static CustomIterable<A> iterable; private static List<A> aList; public static void main(String[] args) { iterable.forEach(a -> aList.add(a)); //ambiguous iterable.forEach(aList::add); //ambiguous iterable.forEach((A a) -> aList.add(a)); //OK } } …
11 java  generics  lambda  javac  ecj 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.