mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-17 20:11:25 +07:00
overload resolution: compare SAMs erasures
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
|
||||
class Test {
|
||||
interface RunnableX extends Callable<String> {
|
||||
void run() throws Exception;
|
||||
|
||||
default String call() throws Exception
|
||||
{
|
||||
run();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
static void foo(RunnableX r){
|
||||
System.out.println(r);
|
||||
}
|
||||
static void foo(Callable<List<?>> c){
|
||||
System.out.println(c);
|
||||
}
|
||||
|
||||
public void test() {
|
||||
foo<error descr="Ambiguous method call: both 'Test.foo(RunnableX)' and 'Test.foo(Callable<List<?>>)' match">(()-> new ArrayList<Void>() )</error>;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Test1 {
|
||||
interface RunnableX extends Callable<List<?>> {
|
||||
void run() throws Exception;
|
||||
|
||||
default List<?> call() throws Exception
|
||||
{
|
||||
run();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
static void foo(RunnableX r){
|
||||
System.out.println(r);
|
||||
}
|
||||
static void foo(Callable<List<?>> c){
|
||||
System.out.println(c);
|
||||
}
|
||||
|
||||
public void test() {
|
||||
foo(()-> new ArrayList<Void>() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user