simplify visitors

This commit is contained in:
Bas Leijdekkers
2013-11-20 15:46:54 +01:00
parent d878e933a7
commit eeba354624
2 changed files with 8 additions and 22 deletions
@@ -51,20 +51,13 @@ public class ErrorRethrownInspection extends BaseInspection {
private static class ErrorRethrownVisitor extends BaseInspectionVisitor {
@Override
public void visitTryStatement(@NotNull PsiTryStatement statement) {
super.visitTryStatement(statement);
final PsiCatchSection[] catchSections = statement.getCatchSections();
for (PsiCatchSection catchSection : catchSections) {
checkCatchSection(catchSection);
}
}
private void checkCatchSection(PsiCatchSection catchSection) {
final PsiParameter parameter = catchSection.getParameter();
public void visitCatchSection(PsiCatchSection section) {
super.visitCatchSection(section);
final PsiParameter parameter = section.getParameter();
if (parameter == null) {
return;
}
final PsiCodeBlock catchBlock = catchSection.getCatchBlock();
final PsiCodeBlock catchBlock = section.getCatchBlock();
if (catchBlock == null) {
return;
}
@@ -51,20 +51,13 @@ public class ThreadDeathRethrownInspection extends BaseInspection {
private static class ThreadDeathRethrownVisitor extends BaseInspectionVisitor {
@Override
public void visitTryStatement(@NotNull PsiTryStatement statement) {
super.visitTryStatement(statement);
final PsiCatchSection[] catchSections = statement.getCatchSections();
for (PsiCatchSection catchSection : catchSections) {
checkCatchSection(catchSection);
}
}
private void checkCatchSection(PsiCatchSection catchSection) {
final PsiParameter parameter = catchSection.getParameter();
public void visitCatchSection(PsiCatchSection section) {
super.visitCatchSection(section);
final PsiParameter parameter = section.getParameter();
if (parameter == null) {
return;
}
final PsiCodeBlock catchBlock = catchSection.getCatchBlock();
final PsiCodeBlock catchBlock = section.getCatchBlock();
if (catchBlock == null) {
return;
}