mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
inference: don't process lambda return expressions for void return type
those lambda return expressions can't influence containing call inference according to lambda constraint; which means that no additional inference variables could be propagated during inference process hence exception constraints could operate with proper types which are in fact type parameters - which would lead to unhandled exceptions on the top level (IDEA-187930)
This commit is contained in:
+56
@@ -0,0 +1,56 @@
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
class Test {
|
||||
|
||||
interface ThrowableRunnable<T extends Throwable> {
|
||||
void run() throws T;
|
||||
}
|
||||
|
||||
interface ThrowableComputable<R, E extends Throwable> {
|
||||
R compute() throws E;
|
||||
}
|
||||
|
||||
private <D extends Throwable> void doTest(ThrowableRunnable<D> action) { }
|
||||
|
||||
|
||||
public void testNoNotificationForWorkspace() {
|
||||
doTest(() -> computeAndWait(() -> foo()));
|
||||
}
|
||||
|
||||
private String foo() throws IOException {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static <R, E extends Throwable> R computeAndWait(ThrowableComputable<R, E> action) throws E {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class TestWithImplicitLambda {
|
||||
|
||||
interface ThrowableRunnable<T extends Throwable> {
|
||||
void run(int k) throws T;
|
||||
}
|
||||
|
||||
interface ThrowableComputable<R, E extends Throwable> {
|
||||
R compute() throws E;
|
||||
}
|
||||
|
||||
private <D extends Throwable> void doTest(ThrowableRunnable<D> action) { }
|
||||
|
||||
|
||||
public void testNoNotificationForWorkspace() {
|
||||
doTest((k) -> computeAndWait(() -> foo()));
|
||||
}
|
||||
|
||||
private String foo() throws IOException {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static <R, E extends Throwable> R computeAndWait(ThrowableComputable<R, E> action) throws E {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user