mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 06:11:42 +07:00
move instance method processor: expand method reference to lambda when needed
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
interface SAM {
|
||||
String m(MethodReference<String> f, F f1);
|
||||
}
|
||||
|
||||
|
||||
class F {
|
||||
String getX() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class MethodReference<X> {
|
||||
|
||||
static void test() {
|
||||
SAM s = (stringMethodReference, f1) -> f1.getX();
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
|
||||
class Bar {
|
||||
void f<caret>oo(int i, Bar1 b1) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Bar1 {
|
||||
|
||||
void m(Bar b) {
|
||||
Bar3 r = b::foo;
|
||||
}
|
||||
}
|
||||
|
||||
interface Bar3 {
|
||||
void m(int i, Bar1 v);
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
|
||||
class Bar {
|
||||
|
||||
}
|
||||
|
||||
class Bar1 {
|
||||
|
||||
void m(Bar b) {
|
||||
Bar3 r = (i, b1) -> b1.foo(i);
|
||||
}
|
||||
|
||||
void foo(int i) {
|
||||
}
|
||||
}
|
||||
|
||||
interface Bar3 {
|
||||
void m(int i, Bar1 v);
|
||||
}
|
||||
+1
-1
@@ -10,7 +10,7 @@ class Test {
|
||||
private final Destination destination = new Destination();
|
||||
|
||||
public void main(Stream<Destination> stream){
|
||||
stream.filter(Test.Destination::notNull);
|
||||
stream.filter(Destination::notNull);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user