mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 00:11:26 +07:00
lambda: void return type compatibility (initial); functional interfaces without method params error messages
This commit is contained in:
+1
-1
@@ -57,7 +57,7 @@ class ReturnTypeCompatibility {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
call(<error descr="Cyclic inference">i-> {return i;}</error>);
|
||||
<error descr="Cannot resolve method 'call(<lambda expression>)'">call</error>(i-> {return i;});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
import java.util.*;
|
||||
class Test4 {
|
||||
interface I<K> {
|
||||
List<K> foo();
|
||||
}
|
||||
|
||||
static <T> void bar(I<T> i){}
|
||||
|
||||
{
|
||||
bar(() -> null);
|
||||
}
|
||||
}
|
||||
|
||||
class Test5 {
|
||||
interface I<K> {
|
||||
void foo(K k);
|
||||
}
|
||||
|
||||
static <T> void bar(I<T> i){}
|
||||
|
||||
{
|
||||
bar<error descr="'bar(Test5.I<T>)' in 'Test5' cannot be applied to '(<lambda expression>)'">(() -> null)</error>;
|
||||
}
|
||||
}
|
||||
class Test6 {
|
||||
interface I<K> {
|
||||
void foo();
|
||||
}
|
||||
|
||||
static <T> void bar(I<T> i){}
|
||||
|
||||
{
|
||||
bar<error descr="'bar(Test6.I<java.lang.Object>)' in 'Test6' cannot be applied to '(<lambda expression>)'">(() -> null)</error>;
|
||||
bar(() -> {});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user