Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/UnhandledExceptionInLambdaChain.java
Anna.Kozlova 877b2424ce 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)
2018-03-08 11:53:52 +01:00

56 lines
1.1 KiB
Java

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;
}
}