lambda: intersection type produces conjunction of abstract methods

This commit is contained in:
Anna Kozlova
2014-04-17 11:58:15 +02:00
parent bd9dbfc7d5
commit 552dfe92a9
4 changed files with 48 additions and 8 deletions

View File

@@ -0,0 +1,20 @@
import java.io.Serializable;
class Test {
interface I {
void foo();
}
interface A {
void bar(int i);
}
{
Object o1 = (Serializable & I) () -> {};
Object o2 = (I & Serializable) () -> {};
Object o3 = (I & Runnable) <error descr="Multiple non-overriding abstract methods found in Runnable & I">() -> {}</error>;
Object o4 = (A & Runnable) <error descr="Multiple non-overriding abstract methods found in Runnable & A">() -> {}</error>;
Object o5 = (Runnable & A) <error descr="Multiple non-overriding abstract methods found in Runnable & A">() -> {}</error>;
}
}