lambda: void return type compatibility (initial); functional interfaces without method params error messages

This commit is contained in:
Anna Kozlova
2012-08-17 22:45:25 +04:00
parent 321d3b9dd0
commit 1fa0a6ade4
5 changed files with 70 additions and 16 deletions
@@ -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;});
}
}
@@ -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(() -> {});
}
}