lambda: infer from return type; cyclic inference stop

This commit is contained in:
Anna Kozlova
2012-08-10 22:41:35 +04:00
parent bff2c6d55c
commit 5ba5425a54
22 changed files with 642 additions and 207 deletions

View File

@@ -0,0 +1,48 @@
public class NotAFIT {
static class First {
static interface A<T> {
void foo1();
void foo2();
}
static <T> void foo(A<T> a) {
}
void bar() {
foo(<error descr="Multiple non-overriding abstract methods found">() ->{}</error>);
}
}
static class WithInheritance {
static interface A<T> {
void foo1();
}
static interface B<M> extends A<M> {
void foo2();
}
static <T> void foo(B<T> a) {
}
void bar() {
foo(<error descr="Multiple non-overriding abstract methods found">()->{}</error>);
}
}
static class WithInheritanceOverrideSameMethod {
static interface A<T> {
void foo1();
}
static interface B<M> extends A<M> {
void foo1();
}
static <T> void foo(B<T> a) {
}
void bar() {
foo(()->{});
}
}
}

View File

@@ -0,0 +1,20 @@
class NoLambda {
interface I<T> {
void f(T t);
}
<Z> void bar(I<Z> iz) {
}
void bazz() {
bar(null);
bar(<error descr="Cyclic inference">(z)-> {System.out.println();}</error>);
}
static <T> T id(T i2) {return i2;}
{
id(<error descr="Cyclic inference">() -> {System.out.println("hi");}</error>);
NoLambda.<Runnable>id(() -> {System.out.println("hi");});
}
}