[java] method references overload resolution (IDEA-276614; IDEA-276613)

check static conflicts between applicable methods vs most specific method of another search, as the spec says

GitOrigin-RevId: d11508968a88888c41f6d69e416ab8fa5e915e5d
This commit is contained in:
Anna Kozlova
2021-08-27 12:37:25 +02:00
committed by intellij-monorepo-bot
parent 7c1c056980
commit f47a4e818b
5 changed files with 29 additions and 43 deletions

View File

@@ -25,7 +25,7 @@ class AlienTest {
static {
IInt i1 = MyTest::<error descr="Cannot resolve method 'abracadabra'">abracadabra</error>;
IInt i2 = MyTest::<error descr="Incompatible types: int is not convertible to String">foo</error>;
IInt i3 = MyTest::<error descr="Reference to 'bar' is ambiguous, both 'bar(Integer, Number)' and 'bar(Number, Integer)' match">bar</error>;
IInt i3 = MyTest::<error descr="Cannot resolve method 'bar'">bar</error>;
IIntInt i4 = MyTest::<error descr="Reference to 'bar' is ambiguous, both 'bar(Integer, Number)' and 'bar(Number, Integer)' match">bar</error>;
IInt i5 = <error descr="Non-static method cannot be referenced from a static context">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>;

View File

@@ -122,7 +122,7 @@ class MyTest4 {
}
{
bar(MyTest4:: <error descr="Reference to 'foo' is ambiguous, both 'foo(int)' and 'foo(String)' match">foo</error>);
bar(MyTest4:: <error descr="Cannot resolve method 'foo'">foo</error>);
}
}

View File

@@ -16,7 +16,7 @@ class Test {
class Test1 {
{
Runnable b = Test1 :: <error descr="Reference to 'length' is ambiguous, both 'length(String)' and 'length(Integer)' match">length</error>;
Runnable b = Test1 :: <error descr="Cannot resolve method 'length'">length</error>;
Comparable<String> c = Test1 :: length;
Comparable<Integer> c1 = Test1 :: length;
}

View File

@@ -50,7 +50,7 @@ class MyTest {
I1 i1 = MyTest::static_1;
I1 i2 = MyTest::<error descr="Cannot resolve method 'static_2'">static_2</error>;
I1 i3 = MyTest::<error descr="Incompatible types: int is not convertible to String">static_3</error>;
I1 i4 = MyTest::<error descr="Reference to 'static_4' is ambiguous, both 'static_4(String...)' and 'static_4(String...)' match">static_4</error>;
I1 i4 = MyTest::<error descr="Cannot resolve method 'static_4'">static_4</error>;
}
@@ -58,7 +58,7 @@ class MyTest {
I1 i_1 = <error descr="Non-static method cannot be referenced from a static context">MyTest::_1</error>;
I1 i_2 = <error descr="Non-static method cannot be referenced from a static context">MyTest::_2</error>;
I1 i_3 = <error descr="Non-static method cannot be referenced from a static context">MyTest::_3</error>;
I1 i_4 = MyTest::<error descr="Reference to '_4' is ambiguous, both '_4(String...)' and '_4(String...)' match">_4</error>;
I1 i_4 = MyTest::<error descr="Cannot resolve method '_4'">_4</error>;
I1 i1 = this::_1;
I1 i2 = this::<error descr="Cannot resolve method '_2'">_2</error>;