move instance method processor: expand method reference to lambda when needed

This commit is contained in:
Anna.Kozlova
2017-04-12 17:31:06 +02:00
parent 17848f40a4
commit 603dfac67a
6 changed files with 103 additions and 30 deletions
@@ -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();
}
}
@@ -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);
}
@@ -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);
}
@@ -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);
}
}