lambda: check lambda return type compatibility before more specific checks (IDEA-97870)

This commit is contained in:
anna
2012-12-20 12:57:18 +01:00
parent 9ea9892deb
commit 5a15076bd6
3 changed files with 32 additions and 3 deletions

View File

@@ -0,0 +1,25 @@
class X {
public static void main(final Stream<String> stream) throws Throwable {
stream.map(s -> s.substring("http://".length())).forEach(System.out::println);
}
}
interface Stream<T> {
<R> Stream<R> map(Function<? super T, ? extends R> mapper);
IntStream map(IntFunction<? super T> mapper);
void forEach(Block<? super T> block);
}
interface IntFunction<T> extends Function<T, Integer> {
public int applyAsInt(T t);
}
interface Function<T, R> {
public R apply(T t);
}
interface IntStream extends BaseStream<Integer> {}
interface BaseStream<T> {}
interface Block<T> {
public void accept(T t);
}