don't show error on method reference if functional expression is located inside invalid context without target functional type

This commit is contained in:
Anna Kozlova
2015-12-10 19:52:16 +01:00
parent b21cde7b47
commit 132bb137a1
19 changed files with 38 additions and 32 deletions

View File

@@ -29,7 +29,7 @@ class MyTest {
{
Bar1 b1 = MyTest :: foo;
bar(MyTest :: <error descr="Cannot resolve method 'foo'">foo</error>);
bar<error descr="Ambiguous method call: both 'MyTest.bar(Bar1)' and 'MyTest.bar(Bar2)' match">(MyTest :: foo)</error>;
}
}

View File

@@ -71,7 +71,7 @@ class StaticInner1 {
static void call3(I2 s) {}
static {
call3(StaticInner1.Inner :: <error descr="Cannot resolve constructor 'Inner'">new</error>);
call3<error descr="Ambiguous method call: both 'StaticInner1.call3(I1)' and 'StaticInner1.call3(I2)' match">(StaticInner1.Inner :: new)</error>;
}
}

View File

@@ -49,7 +49,7 @@ class MyTestConstructor {
private static void <warning descr="Private method 'foo(MyTestConstructor.I3)' is never used">foo</warning>(I3 i) {System.out.println(i);}
static {
foo(Foo::<error descr="Cannot resolve constructor 'Foo'">new</error>);
foo<error descr="Ambiguous method call: both 'MyTestConstructor.foo(I1)' and 'MyTestConstructor.foo(I2)' match">(Foo::new)</error>;
}
}
@@ -78,6 +78,6 @@ class MyTestMethod {
private static void <warning descr="Private method 'foo(MyTestMethod.I3)' is never used">foo</warning>(I3 i) {System.out.println(i);}
static {
foo(MyTestMethod::<error descr="Cannot resolve method 'm'">m</error>);
foo<error descr="Ambiguous method call: both 'MyTestMethod.foo(I1)' and 'MyTestMethod.foo(I2)' match">(MyTestMethod::m)</error>;
}
}

View File

@@ -38,7 +38,7 @@ class MyTest1 {
}
public static void main(String[] args) {
call(1, MyTest1::<error descr="Cannot resolve method 'm'">m</error>);
call<error descr="Ambiguous method call: both 'MyTest1.call(int, I1)' and 'MyTest1.call(int, I2)' match">(1, MyTest1::m)</error>;
}
}
@@ -192,6 +192,6 @@ class MyTest9 {
void test() {
g1(MyTest9::m);
g2(MyTest9::<error descr="Cannot resolve method 'm'">m</error>);
g2<error descr="Ambiguous method call: both 'MyTest9.g2(I1)' and 'MyTest9.g2(I2)' match">(MyTest9::m)</error>;
}
}

View File

@@ -20,8 +20,8 @@ class MyTest {
static void foo(I3 i) {}
static {
foo(MyTest::<error descr="Cannot resolve method 'm'">m</error>);
foo(MyTest::<error descr="Cannot resolve method 'm1'">m1</error>);
foo<error descr="Ambiguous method call: both 'MyTest.foo(I1)' and 'MyTest.foo(I2)' match">(MyTest::m)</error>;
foo<error descr="Ambiguous method call: both 'MyTest.foo(I1)' and 'MyTest.foo(I2)' match">(MyTest::m1)</error>;
}
}
@@ -44,9 +44,9 @@ class MyTest1 {
static {
foo1(MyTest1::m);
foo2(MyTest1::<error descr="Cannot resolve method 'm'">m</error>);
foo2<error descr="Ambiguous method call: both 'MyTest1.foo2(I1)' and 'MyTest1.foo2(I2)' match">(MyTest1::m)</error>;
foo1(MyTest1::m1);
foo2(MyTest1::<error descr="Cannot resolve method 'm1'">m1</error>);
foo2<error descr="Ambiguous method call: both 'MyTest1.foo2(I1)' and 'MyTest1.foo2(I2)' match">(MyTest1::m1)</error>;
}
}

View File

@@ -39,6 +39,6 @@ class MyTest1 {
static void foo(I3 i) {}
static {
foo(Foo::<error descr="Cannot resolve constructor 'Foo'">new</error>);
foo<error descr="Ambiguous method call: both 'MyTest1.foo(I1)' and 'MyTest1.foo(I2)' match">(Foo::new)</error>;
}
}

View File

@@ -29,7 +29,7 @@ class MyTest {
}
public static void main(String[] args) {
foo(Foo::<error descr="Cannot resolve method 'm'">m</error>);
foo<error descr="Ambiguous method call: both 'MyTest.foo(I1)' and 'MyTest.foo(I2)' match">(Foo::m)</error>;
}
}
@@ -67,7 +67,7 @@ class MyTest1 {
}
public static void main(String[] args) {
m(Foo::<error descr="Cannot resolve constructor 'Foo'">new</error>);
m<error descr="Ambiguous method call: both 'MyTest1.m(I1)' and 'MyTest1.m(I2)' match">(Foo::new)</error>;
}
}
class MyTest2 {
@@ -104,6 +104,6 @@ class MyTest2 {
}
public static void main(String[] args) {
m(Foo::<error descr="Cannot resolve constructor 'Foo'">new</error>);
m<error descr="Ambiguous method call: both 'MyTest2.m(I1)' and 'MyTest2.m(I2)' match">(Foo::new)</error>;
}
}

View File

@@ -2,7 +2,7 @@ import java.util.*;
class LambdaTest {
public void testR() {
new ArrayList<String>() :: <error descr="Cannot resolve method 'size'">size</error> = "";
<error descr="Incompatible types. Found: 'java.lang.String', required: '<method reference>'">new ArrayList<String>() :: size = ""</error>;
}
}

View File

@@ -116,7 +116,7 @@ class MyTest2 {
static void call3(I2 s) {}
static {
call3(MyTest2::m1);
call3(MyTest2::<error descr="Cannot resolve method 'm2'">m2</error>);
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>;
}

View File

@@ -1,6 +1,6 @@
public class Test {
{
if (Test::<error descr="Cannot resolve method 'length'">length</error> instanceof String) {
if (<error descr="Method reference expression is not expected here">Test::length instanceof String</error>) {
}
bar(Test::length);
}