method ref: accept non parameterized receivers (IDEA-101168)

This commit is contained in:
anna
2013-02-15 12:51:10 +01:00
parent 7b5b919239
commit 38ce821958
3 changed files with 45 additions and 2 deletions

View File

@@ -0,0 +1,34 @@
class IDEA101168<E> {
public void foo(Stream<OfPrimitive<E>> stream, Collector<CharSequence, Double> collector) {
stream.map(Object ::toString).collect(collector);
}
interface OfPrimitive<A> {
}
interface Collector<T, R> {
interface OfInt<R> extends Collector<Integer, R> {
}
}
interface Stream<T> extends BaseStream<T> {
<R> Stream<R> map(Function<? super T, ? extends R> mapper);
IntStream map(ToIntFunction<? super T> mapper);
<R> R collect(Collector<? super T, R> collector);
}
interface Function<T, R> {
public R apply(T t);
}
interface ToIntFunction<T> {
public int applyAsInt(T t);
}
interface IntStream extends BaseStream<Integer> {
<R> R collect(Collector.OfInt<R> collector);
}
interface BaseStream<T> {}
}