lambda -> method refs: cleanup ambiguity between receiver/non-receiver methods

This commit is contained in:
Anna Kozlova
2014-11-11 17:17:53 +01:00
parent 80c0cd1a42
commit bf5b3ed5b2
7 changed files with 170 additions and 17 deletions

View File

@@ -0,0 +1,26 @@
// "Replace lambda with method reference" "true"
interface I {
String foo(Foo i);
}
interface Bar {
String foo();
}
class Foo implements Bar {
public String foo() {
return null;
}
String foo(int i) {
return null;
}
static String foo(Foo foo) {
return null;
}
public static void main(String[] args) {
I i = Bar::foo;
}
}

View File

@@ -0,0 +1,22 @@
// "Replace lambda with method reference" "true"
interface I {
String foo(Foo i);
}
class Foo {
public String foo() {
return null;
}
String foo(int i) {
return null;
}
String foo(Foo foo) {
return null;
}
public static void main(String[] args) {
I i = Foo::foo;
}
}

View File

@@ -0,0 +1,22 @@
// "Replace lambda with method reference" "true"
interface I {
String foo(Foo i);
}
class Foo {
public String foo() {
return null;
}
String foo(int i) {
return null;
}
static String foo(Foo foo, boolean b) {
return null;
}
public static void main(String[] args) {
I i = Foo::foo;
}
}

View File

@@ -0,0 +1,26 @@
// "Replace lambda with method reference" "true"
interface I {
String foo(Foo i);
}
interface Bar {
String foo();
}
class Foo implements Bar {
public String foo() {
return null;
}
String foo(int i) {
return null;
}
static String foo(Foo foo) {
return null;
}
public static void main(String[] args) {
I i = (foo) -> foo.f<caret>oo();
}
}

View File

@@ -0,0 +1,22 @@
// "Replace lambda with method reference" "true"
interface I {
String foo(Foo i);
}
class Foo {
public String foo() {
return null;
}
String foo(int i) {
return null;
}
String foo(Foo foo) {
return null;
}
public static void main(String[] args) {
I i = (foo) -> foo.f<caret>oo();
}
}

View File

@@ -0,0 +1,22 @@
// "Replace lambda with method reference" "true"
interface I {
String foo(Foo i);
}
class Foo {
public String foo() {
return null;
}
String foo(int i) {
return null;
}
static String foo(Foo foo, boolean b) {
return null;
}
public static void main(String[] args) {
I i = (foo) -> foo.f<caret>oo();
}
}