method refs: compilation error when static method is accept through instance reference

This commit is contained in:
anna
2013-02-26 14:16:08 +01:00
parent af83c60af8
commit ed8986937e
6 changed files with 24 additions and 5 deletions

View File

@@ -30,7 +30,7 @@ class AlienTest {
<error descr="Incompatible types. Found: '<method reference>', required: 'AlienTest.IInt'">IInt i3 = MyTest::bar;</error>
<error descr="Incompatible types. Found: '<method reference>', required: 'AlienTest.IIntInt'">IIntInt i4 = MyTest::bar;</error>
<error descr="Incompatible types. Found: '<method reference>', required: 'AlienTest.IInt'">IInt i5 = MyTest::baz;</error>
IInt i6 = <error descr="'foo(int)' is not public in 'MyTest.Foo'. Cannot be accessed from outside package">MyTest.foo::foo</error>;
<error descr="Incompatible types. Found: '<method reference>', required: 'AlienTest.IInt'">IInt i6 = MyTest.foo::foo;</error>
IInt i7 = MyTest.<error descr="'MyTest.Foo' has private access in 'MyTest'">Foo</error>::foo;
}
}

View File

@@ -68,7 +68,7 @@ class MyTest3 {
static void m() { }
public static void main(String[] args) {
I s = new MyTest3()::m;
<error descr="Incompatible types. Found: '<method reference>', required: 'MyTest3.I'">I s = new MyTest3()::m;</error>
}
}

View File

@@ -0,0 +1,15 @@
class Test<X> {
interface I {
void _();
}
void test() {
<error descr="Incompatible types. Found: '<method reference>', required: 'Test.I'">I i1 = Test<String>::foo;</error>
I i2 = Test::foo;
}
static void foo() { };
}

View File

@@ -7,8 +7,8 @@ class Test<T> {
Test test = new Test<String>();
BlahBlah<String> blahBlah = test::<String>foo;
BlahBlah<String> blahBlah1 = test::<String>foo1;
BlahBlah<String> blahBlah2 = test::<String>foo2;
BlahBlah<String> blahBlah3 = test::<String>foo3;
<error descr="Incompatible types. Found: '<method reference>', required: 'BlahBlah<java.lang.String>'">BlahBlah<String> blahBlah2 = test::<String>foo2;</error>
<error descr="Incompatible types. Found: '<method reference>', required: 'BlahBlah<java.lang.String>'">BlahBlah<String> blahBlah3 = test::<String>foo3;</error>
}
}