diff --git a/java/java-tests/testData/inspection/defUse/TryWithFinally.java b/java/java-tests/testData/inspection/defUse/TryWithFinally.java new file mode 100644 index 000000000000..e0301e5d7a11 --- /dev/null +++ b/java/java-tests/testData/inspection/defUse/TryWithFinally.java @@ -0,0 +1,15 @@ +class TryWithFinally { + static class Resource implements AutoCloseable { + public void close() throws Exception { } + boolean find() { throw new UnsupportedOperationException(); } + } + + void test() throws Exception { + boolean found = false; + try (Resource r = new Resource()) { + found = r.find(); + } + finally { } + System.out.println(found); + } +} \ No newline at end of file diff --git a/java/java-tests/testData/inspection/defUse/TryWithoutFinally.java b/java/java-tests/testData/inspection/defUse/TryWithoutFinally.java new file mode 100644 index 000000000000..1fd425f56e5b --- /dev/null +++ b/java/java-tests/testData/inspection/defUse/TryWithoutFinally.java @@ -0,0 +1,14 @@ +class TryWithoutFinally { + static class Resource implements AutoCloseable { + public void close() throws Exception { } + boolean find() { throw new UnsupportedOperationException(); } + } + + void test() throws Exception { + boolean found = false; + try (Resource r = new Resource()) { + found = r.find(); + } + System.out.println(found); + } +} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/DefUseTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/DefUseTest.java index f5381b03f6c6..62ddd52b6d8a 100644 --- a/java/java-tests/testSrc/com/intellij/codeInspection/DefUseTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInspection/DefUseTest.java @@ -17,8 +17,11 @@ package com.intellij.codeInspection; import com.intellij.JavaTestUtil; import com.intellij.codeInspection.defUse.DefUseInspection; +import com.intellij.idea.Bombed; import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase; +import java.util.Calendar; + public class DefUseTest extends LightCodeInsightFixtureTestCase { @Override protected String getBasePath() { @@ -35,6 +38,8 @@ public class DefUseTest extends LightCodeInsightFixtureTestCase { public void testUsedInArrayInitializer() { doTest(); } public void testHang() { doTest(); } public void testOperatorAssignment() { doTest(); } + @Bombed(user="roman.shevchenko@jetbrains.com", day=1, month=Calendar.AUGUST, year=2017) public void testTryWithFinally() { doTest(); } + public void testTryWithoutFinally() { doTest(); } private void doTest() { myFixture.enableInspections(new DefUseInspection());