mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-07 13:39:36 +07:00
new overload resolution: reject complete normally when last instruction is return (IDEA-134808)
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
class Test {
|
||||
public interface A<E extends Throwable> {
|
||||
Object call() throws E;
|
||||
}
|
||||
|
||||
public interface B<E extends Throwable> {
|
||||
void call() throws E;
|
||||
}
|
||||
|
||||
static Object method(A lambda) {
|
||||
System.out.println("A::");
|
||||
try {
|
||||
lambda.call();
|
||||
} catch (Throwable throwable) {
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static void method(B lambda) {
|
||||
System.out.println("B::");
|
||||
try {
|
||||
lambda.call();
|
||||
} catch (Throwable throwable) {
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
static Object returns(String s) throws Exception {
|
||||
System.out.println(s); return null;
|
||||
}
|
||||
|
||||
static void voids(String s) throws Exception {
|
||||
System.out.println(s);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
method(() -> {
|
||||
voids("-> B");
|
||||
});
|
||||
|
||||
|
||||
method(() -> voids("-> B"));
|
||||
|
||||
method(() -> {
|
||||
return returns("-> A");
|
||||
});
|
||||
|
||||
method(() -> returns("-> A") );
|
||||
|
||||
method(() -> {
|
||||
returns("-> B");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user