mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-01 10:48:09 +07:00
lambda: return type checks initial
This commit is contained in:
@@ -16,4 +16,20 @@ class Foo {
|
||||
bar((int i) -> {System.out.println(i);});
|
||||
}
|
||||
void bar(I i){}
|
||||
}
|
||||
|
||||
class ReturnTypeCompatibility {
|
||||
|
||||
interface I1<L> {
|
||||
L m(L x);
|
||||
}
|
||||
|
||||
static <P> void call(I1<P> i2) {
|
||||
i2.m(null);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
call((String i)->{ return i;});
|
||||
call<error descr="'call(ReturnTypeCompatibility.I1<java.lang.Object>)' in 'ReturnTypeCompatibility' cannot be applied to '(<lambda expression>)'">((int i)->{ return i;})</error>;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user