IDEA-94910 (control flow for resource variables fixed)

This commit is contained in:
Roman Shevchenko
2012-12-05 18:15:35 +01:00
parent 3abad067e3
commit cd78bed856
2 changed files with 7 additions and 9 deletions
@@ -777,11 +777,6 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
public void visitTryStatement(PsiTryStatement statement) {
startElement(statement);
PsiResourceList resourceList = statement.getResourceList();
if (resourceList != null) {
resourceList.accept(this);
}
PsiCodeBlock finallyBlock = statement.getFinallyBlock();
if (finallyBlock != null) {
myCatchStack.push(new CatchDescriptor(finallyBlock));
@@ -806,6 +801,11 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
int endOffset = finallyBlock == null ? getEndOffset(statement) : getStartOffset(finallyBlock) - 2;
PsiResourceList resourceList = statement.getResourceList();
if (resourceList != null) {
resourceList.accept(this);
}
PsiCodeBlock tryBlock = statement.getTryBlock();
if (tryBlock != null) {
tryBlock.accept(this);
@@ -1,5 +1,3 @@
import java.lang.Exception;
class Test {
static class MyResource implements AutoCloseable {
@Override public void close() { }
@@ -22,7 +20,7 @@ class Test {
}
}
/*static class ResourcefulException1 extends Exception { }
static class ResourcefulException1 extends Exception { }
static class ResourcefulException2 extends Exception { }
static class ExceptionalResource implements AutoCloseable {
@@ -45,5 +43,5 @@ class Test {
System.out.println("2");
}
}
}*/
}
}