methods refs: check if default constructor is acceptable

This commit is contained in:
anna
2012-10-09 19:22:15 +02:00
parent e0504f5cc3
commit 2e599091fd
2 changed files with 23 additions and 2 deletions

View File

@@ -44,3 +44,15 @@ class DefaultConstructor1 {
Runnable b1 = DefaultConstructor1 :: new;
}
}
class DefaultConstructor2 {
interface I {
void foo(DefaultConstructor2 e);
}
void f() {
<error descr="Incompatible types. Found: '<method reference>', required: 'DefaultConstructor2.I'">I i1 = DefaultConstructor2 :: new;</error>
<error descr="Incompatible types. Found: '<method reference>', required: 'DefaultConstructor2.I'">I i2 = this::new;</error>
}
}