mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 13:02:30 +07:00
delete catch fix: introduce ARM
This commit is contained in:
@@ -53,7 +53,7 @@ public class DeleteCatchFix implements IntentionAction {
|
||||
if (!FileModificationService.getInstance().prepareFileForWrite(myCatchParameter.getContainingFile())) return;
|
||||
|
||||
final PsiTryStatement tryStatement = ((PsiCatchSection)myCatchParameter.getDeclarationScope()).getTryStatement();
|
||||
if (tryStatement.getCatchBlocks().length == 1 && tryStatement.getFinallyBlock() == null) {
|
||||
if (tryStatement.getCatchBlocks().length == 1 && tryStatement.getFinallyBlock() == null && tryStatement.getResourceList() == null) {
|
||||
// unwrap entire try statement
|
||||
final PsiCodeBlock tryBlock = tryStatement.getTryBlock();
|
||||
PsiElement lastAddedStatement = null;
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
// "Delete catch for 'java.lang.ClassNotFoundException'" "true"
|
||||
import java.io.*;
|
||||
|
||||
class Cl implements AutoCloseable {
|
||||
public void close() throws IOException {
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
|
||||
class a {
|
||||
void f() throws IOException {
|
||||
try (Cl c = new Cl()) {
|
||||
c.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// "Delete catch for 'java.lang.ClassNotFoundException'" "true"
|
||||
import java.io.*;
|
||||
|
||||
class Cl implements AutoCloseable {
|
||||
public void close() throws IOException {
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
|
||||
class a {
|
||||
void f() throws IOException {
|
||||
try (Cl c = new Cl()) {
|
||||
c.close();
|
||||
} catch (<caret>ClassNotFoundException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user