From e32dfdfa8abad9698f6f6bfc6bc61f43ed28c59d Mon Sep 17 00:00:00 2001 From: Anna Kozlova Date: Thu, 15 Oct 2015 15:02:50 +0200 Subject: [PATCH] UnsupportedOperationException --- .../intellij/codeInsight/ExceptionUtil.java | 4 ++-- .../ExceptionCollectionWithLambda.java | 24 +++++++++++++++++++ .../lambda/GenericsHighlighting8Test.java | 4 ++++ 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/ExceptionCollectionWithLambda.java diff --git a/java/java-psi-impl/src/com/intellij/codeInsight/ExceptionUtil.java b/java/java-psi-impl/src/com/intellij/codeInsight/ExceptionUtil.java index 92fe13866aac..ec6c6d740217 100644 --- a/java/java-psi-impl/src/com/intellij/codeInsight/ExceptionUtil.java +++ b/java/java-psi-impl/src/com/intellij/codeInsight/ExceptionUtil.java @@ -268,10 +268,10 @@ public class ExceptionUtil { else if (element instanceof PsiMethodReferenceExpression) { PsiExpression qualifierExpression = ((PsiMethodReferenceExpression)element).getQualifierExpression(); return qualifierExpression != null ? collectUnhandledExceptions(qualifierExpression, topElement, null, false) - : Collections.emptySet(); + : null; } else if (element instanceof PsiLambdaExpression) { - return Collections.emptySet(); + return null; } else if (element instanceof PsiThrowStatement) { PsiThrowStatement statement = (PsiThrowStatement)element; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/ExceptionCollectionWithLambda.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/ExceptionCollectionWithLambda.java new file mode 100644 index 000000000000..1ffb96765917 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/ExceptionCollectionWithLambda.java @@ -0,0 +1,24 @@ + + + +import java.io.File; +import java.io.IOException; +interface I { + void m(String s) throws IOException; +} +class Test { + public void test() throws IOException { + File file = new File("temp"); + try { + for(int t = 0; t < 4; ++t) { + for (int i = 0; i < 10; ++i) { + I appender = out -> File.createTempFile("", "").exists(); + appender.m(""); + } + } + } + finally { + System.out.println(file); + } + } +} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GenericsHighlighting8Test.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GenericsHighlighting8Test.java index cb844b1b9142..9f10ace0ccce 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GenericsHighlighting8Test.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GenericsHighlighting8Test.java @@ -869,4 +869,8 @@ public class GenericsHighlighting8Test extends LightDaemonAnalyzerTestCase { public void testIDEA107713() throws Exception { doTest(); } + + public void testExceptionCollectionWithLambda() throws Exception { + doTest(); + } }