mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-11 11:36:59 +07:00
lambda -> method refs: cleanup ambiguity between receiver/non-receiver methods
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user