anonymous -> lambda: accept anonymous classes with inferred another type and ref to a parameter as the cast would be inserted (IDEA-157457)

This commit is contained in:
Anna Kozlova
2016-06-15 13:44:38 +03:00
parent fc4bbbde7c
commit f7fbc4b4bc
5 changed files with 36 additions and 43 deletions
@@ -0,0 +1,12 @@
// "Replace with lambda" "true"
import java.util.function.Function;
class Test {
void ab() {
comparing((Function<Integer, String>) pObj -> Integer.toString(pObj));
}
static <T> void comparing(Function<T, String> keyExtractor){}
}
@@ -0,0 +1,20 @@
// "Replace with lambda" "true"
class DbTableBinder {
public Binder build() {
return (Binder<DbTable>) (q, dbTable) -> q.bind("name", dbTable.name);
}
}
class DbTable {
String name;
}
interface Binder <ArgType> {
void bind(A<?> sqlStatement, ArgType argType);
}
interface A<P> {
void bind(String s, String p);
}
@@ -1,4 +1,4 @@
// "Replace with lambda" "false"
// "Replace with lambda" "true"
import java.util.function.Function;
class Test {
@@ -1,4 +1,4 @@
// "Replace with lambda" "false"
// "Replace with lambda" "true"
class DbTableBinder {
public Binder build() {