mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 05:10:22 +07:00
EmptyStatementBodyInspection: delete body on empty foreach
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
// "Delete element" "true"
|
||||
class Test {
|
||||
void test(String[] arr) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Delete element" "true"
|
||||
class Test {
|
||||
void test(String[] arr) {
|
||||
fo<caret>r (String string : arr) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -125,7 +125,10 @@ public class EmptyStatementBodyInspection extends BaseInspection {
|
||||
@Override
|
||||
public void visitForeachStatement(@NotNull PsiForeachStatement statement) {
|
||||
super.visitForeachStatement(statement);
|
||||
checkLoopStatement(statement);
|
||||
final PsiStatement body = statement.getBody();
|
||||
if (body != null && isEmpty(body)) {
|
||||
registerStatementError(statement, createFix(statement, statement.getIteratedValue()));
|
||||
}
|
||||
}
|
||||
|
||||
private void checkLoopStatement(PsiLoopStatement statement) {
|
||||
|
||||
Reference in New Issue
Block a user