diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java index 8ad03948b1a8..a0d53a8c3810 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java @@ -501,7 +501,7 @@ public class InferenceSession { boolean addConstraint, PsiSubstitutor initialSubstitutor) { final PsiType interfaceReturnType = LambdaUtil.getFunctionalInterfaceReturnType(parameterType); - if (interfaceReturnType != null) { + if (interfaceReturnType != null && !PsiType.VOID.equals(interfaceReturnType)) { final List returnExpressions = LambdaUtil.getReturnExpressions(lambdaExpression); for (PsiExpression returnExpression : returnExpressions) { processReturnExpression(additionalConstraints, ignoredConstraints, returnExpression, interfaceReturnType, addConstraint, initialSubstitutor); diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/UnhandledExceptionInLambdaChain.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/UnhandledExceptionInLambdaChain.java new file mode 100644 index 000000000000..c39a082ae48b --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/UnhandledExceptionInLambdaChain.java @@ -0,0 +1,56 @@ + +import java.io.IOException; + +class Test { + + interface ThrowableRunnable { + void run() throws T; + } + + interface ThrowableComputable { + R compute() throws E; + } + + private void doTest(ThrowableRunnable action) { } + + + public void testNoNotificationForWorkspace() { + doTest(() -> computeAndWait(() -> foo())); + } + + private String foo() throws IOException { + return null; + } + + + public static R computeAndWait(ThrowableComputable action) throws E { + return null; + } +} + +class TestWithImplicitLambda { + + interface ThrowableRunnable { + void run(int k) throws T; + } + + interface ThrowableComputable { + R compute() throws E; + } + + private void doTest(ThrowableRunnable action) { } + + + public void testNoNotificationForWorkspace() { + doTest((k) -> computeAndWait(() -> foo())); + } + + private String foo() throws IOException { + return null; + } + + + public static R computeAndWait(ThrowableComputable action) throws E { + return null; + } +} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java index 16a469412910..74216f085a77 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java @@ -164,6 +164,7 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase { public void testVoidValueCompatibilityWithBreakInSwitch() { doTest(); } public void testExceptionInferenceForVarargMethods() { doTest(); } public void testConditionalBooleanAsFunctionalInterfaceType() { doTest(); } + public void testUnhandledExceptionInLambdaChain() { doTest(); } private void doTest() { IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());