mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-30 10:20:15 +07:00
lambda -> method refs: check if result method reference is valid
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
// "Replace lambda with method reference" "true"
|
||||
class Example {
|
||||
public void m() {
|
||||
}
|
||||
|
||||
{
|
||||
Runnable r = ex()::m;
|
||||
}
|
||||
|
||||
Example ex() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// "Replace lambda with method reference" "false"
|
||||
import java.io.PrintStream;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
class Test {
|
||||
{
|
||||
BiConsumer<PrintStream, String> printer = (printStream, x) -> get(printSt<caret>ream).println(x);
|
||||
}
|
||||
|
||||
PrintStream get(PrintStream p) {return p;}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// "Replace lambda with method reference" "true"
|
||||
class Example {
|
||||
public void m() {
|
||||
}
|
||||
|
||||
{
|
||||
Runnable r = () -> ex().<caret>m();
|
||||
}
|
||||
|
||||
Example ex() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user