mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java] test cases for IDEA-155836
This commit is contained in:
@@ -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 = <warning descr="Variable 'found' initializer 'false' is redundant">false</warning>;
|
||||
try (Resource r = new Resource()) {
|
||||
found = r.find();
|
||||
}
|
||||
finally { }
|
||||
System.out.println(found);
|
||||
}
|
||||
}
|
||||
@@ -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 = <warning descr="Variable 'found' initializer 'false' is redundant">false</warning>;
|
||||
try (Resource r = new Resource()) {
|
||||
found = r.find();
|
||||
}
|
||||
System.out.println(found);
|
||||
}
|
||||
}
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user