1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
class MyTest {
interface I {
String m(Foo f);
}
static class Foo<X> {
String foo() { return null; }
Foo<X> getFoo() { return this; }
static void test() {
I i1 = Foo.<error descr="Non-static method 'getFoo()' cannot be referenced from a static context">getFoo</error>()::foo;
I i2 = <error descr="'MyTest.Foo.this' cannot be referenced from a static context">this</error>::foo;
I i3 = Foo :: foo;
}
}
}
class MyTest1 {
void m1(MyTest1 rec, String x) { }
void m1(String x) { }
static void m2(String x) { }
static void m2(MyTest1 rec, String x) {}
void m3(MyTest1 rec, String x) { }
static void m3(String x) { }
void m4(String x) { }
static void m4(MyTest1 rec, String x) { }
interface I1 {
void m(String x);
}
interface I2 {
void m(MyTest1 rec, String x);
}
static void call1(I1 s) { }
static void call2(I2 s) { }
static void test1() {
<error descr="Incompatible types. Found: '<method reference>', required: 'MyTest1.I1'">I1 s1 = MyTest1 ::m1;</error>
call1<error descr="'call1(MyTest1.I1)' in 'MyTest1' cannot be applied to '(<method reference>)'">(MyTest1::m1)</error>;
I1 s2 = MyTest1 :: m2;
call1(MyTest1::m2);
I1 s3 = MyTest1::m3;
call1(MyTest1::m3);
<error descr="Incompatible types. Found: '<method reference>', required: 'MyTest1.I1'">I1 s4 = MyTest1::m4;</error>
call1<error descr="'call1(MyTest1.I1)' in 'MyTest1' cannot be applied to '(<method reference>)'">(MyTest1::m4)</error>;
}
static void test2() {
I2 s1 = MyTest1 :: m1;
call2(MyTest1::m1);
I2 s2 = MyTest1 :: m2;
call2(MyTest1::m2);
<error descr="Incompatible types. Found: '<method reference>', required: 'MyTest1.I2'">I2 s3 = MyTest1 :: m3;</error>
call2<error descr="'call2(MyTest1.I2)' in 'MyTest1' cannot be applied to '(<method reference>)'">(MyTest1::m3)</error>;
<error descr="Incompatible types. Found: '<method reference>', required: 'MyTest1.I2'">I2 s4 = MyTest1 ::m4;</error>
call2<error descr="'call2(MyTest1.I2)' in 'MyTest1' cannot be applied to '(<method reference>)'">(MyTest1::m4)</error>;
}
}
class MyTest2 {
void m1(String x) { }
void m1(MyTest2 rec, String x) { }
static void m2(MyTest2 rec, String x) {}
static void m2(String x) { }
static void m3(String x) { }
void m3(MyTest2 rec, String x) { }
static void m4(MyTest2 rec, String x) { }
void m4(String x) { }
interface I1 {
void m(String x);
}
interface I2 {
void m(MyTest2 rec, String x);
}
static void call1(I1 s) { }
static void call2(I2 s) { }
static void test1() {
<error descr="Incompatible types. Found: '<method reference>', required: 'MyTest2.I1'">I1 s1 = MyTest2 ::m1;</error>
call1<error descr="'call1(MyTest2.I1)' in 'MyTest2' cannot be applied to '(<method reference>)'">(MyTest2::m1)</error>;
I1 s2 = MyTest2 :: m2;
call1(MyTest2::m2);
I1 s3 = MyTest2::m3;
call1(MyTest2::m3);
<error descr="Incompatible types. Found: '<method reference>', required: 'MyTest2.I1'">I1 s4 = MyTest2::m4;</error>
call1<error descr="'call1(MyTest2.I1)' in 'MyTest2' cannot be applied to '(<method reference>)'">(MyTest2::m4)</error>;
}
static void test2() {
I2 s1 = MyTest2 :: m1;
call2(MyTest2::m1);
I2 s2 = MyTest2 :: m2;
call2(MyTest2::m2);
<error descr="Incompatible types. Found: '<method reference>', required: 'MyTest2.I2'">I2 s3 = MyTest2 :: m3;</error>
call2<error descr="'call2(MyTest2.I2)' in 'MyTest2' cannot be applied to '(<method reference>)'">(MyTest2::m3)</error>;
<error descr="Incompatible types. Found: '<method reference>', required: 'MyTest2.I2'">I2 s4 = MyTest2 ::m4;</error>
call2<error descr="'call2(MyTest2.I2)' in 'MyTest2' cannot be applied to '(<method reference>)'">(MyTest2::m4)</error>;
}
static void call3(I1 s) {}
static void call3(I2 s) {}
static {
call3(MyTest2::m1);
call3<error descr="Ambiguous method call: both 'MyTest2.call3(I1)' and 'MyTest2.call3(I2)' match">(MyTest2::m2)</error>;
call3(MyTest2::m3);
call3<error descr="'call3(MyTest2.I2)' in 'MyTest2' cannot be applied to '(<method reference>)'">(MyTest2::m4)</error>;
}
}
|