diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ControlFlowAnalyzer.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ControlFlowAnalyzer.java index 24850aa689c5..3802bcc4d9e7 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ControlFlowAnalyzer.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ControlFlowAnalyzer.java @@ -659,7 +659,6 @@ class ControlFlowAnalyzer extends JavaElementVisitor { PsiType type = cd.getLubType(); if (type instanceof PsiClassType && ExceptionUtil.isUncheckedExceptionOrSuperclass((PsiClassType)type)) { addConditionalRuntimeThrow(cd, true); - break; } } } diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/CatchThrowable.java b/java/java-tests/testData/inspection/dataFlow/fixture/CatchThrowable.java new file mode 100644 index 000000000000..b055937e8b4e --- /dev/null +++ b/java/java-tests/testData/inspection/dataFlow/fixture/CatchThrowable.java @@ -0,0 +1,26 @@ +public class BrokenAlignment { + + public static void main(String[] args) { + + Throwable error = null; + try { + doSomething(); + } catch (AssertionError e) { + // rethrow error + throw e; + } catch (Throwable e) { + // remember error + error = e; + } + + if (error != null) { // <<--- inspection warning + // handle error ... + } + + } + + public static void doSomething() { + throw new RuntimeException("dummy"); + } + +} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java index 63f946079a49..6141ea53df20 100644 --- a/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java @@ -99,6 +99,7 @@ public class DataFlowInspectionTest extends LightCodeInsightFixtureTestCase { public void testReturningNullFromVoidMethod() throws Throwable { doTest(); } public void testCatchRuntimeException() throws Throwable { doTest(); } + public void testCatchThrowable() throws Throwable { doTest(); } public void testNotNullCatchParameter() { doTest(); } public void testAssertFailInCatch() throws Throwable {