mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 00:11:26 +07:00
method refs: ambiguity (IDEA-113078)
This commit is contained in:
+29
@@ -0,0 +1,29 @@
|
||||
class App {
|
||||
|
||||
public static void main(String[] args) {
|
||||
test(App::getLength);
|
||||
}
|
||||
|
||||
private static Integer getLength(String word) {
|
||||
return word.length();
|
||||
}
|
||||
|
||||
|
||||
private static void <warning descr="Private method 'test(App.Consumer<java.lang.String>)' is never used">test</warning>(Consumer<String> consumer) {
|
||||
consumer.accept("Hello World");
|
||||
}
|
||||
|
||||
private static void test(Function<String, Integer> function) {
|
||||
Integer result = function.apply("Hello World");
|
||||
System.out.println(result);
|
||||
}
|
||||
|
||||
interface Function<T, R> {
|
||||
R apply(T t);
|
||||
}
|
||||
|
||||
interface Consumer<T> {
|
||||
void accept(T t);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user