Surround with try/catch fix made aware of try-with-resources

This commit is contained in:
Roman Shevchenko
2011-03-01 20:34:18 +01:00
parent 77f94dbece
commit 618e0e3ac0
5 changed files with 77 additions and 18 deletions
@@ -0,0 +1,17 @@
// "Surround with try/catch" "true"
class C {
static class E1 extends Exception { }
static class MyResource implements AutoCloseable {
public void close() throws E1 { }
}
void m() {
try {
try (MyResource r = new MyResource()) {
}
} catch (E1 e1) {
<selection>e1.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.</selection>
}
}
}
@@ -0,0 +1,13 @@
// "Surround with try/catch" "true"
class C {
static class E1 extends Exception { }
static class MyResource implements AutoCloseable {
public void close() throws E1 { }
}
void m() {
try (<caret>MyResource r = new MyResource()) {
}
}
}