mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 03:13:40 +07:00
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:
+12
@@ -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){}
|
||||
|
||||
}
|
||||
+20
@@ -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
-1
@@ -1,4 +1,4 @@
|
||||
// "Replace with lambda" "false"
|
||||
// "Replace with lambda" "true"
|
||||
import java.util.function.Function;
|
||||
|
||||
class Test {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Replace with lambda" "false"
|
||||
// "Replace with lambda" "true"
|
||||
class DbTableBinder {
|
||||
|
||||
public Binder build() {
|
||||
|
||||
Reference in New Issue
Block a user