From eeba3546242029497e1d63191be72cfb77d3f54b Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Wed, 20 Nov 2013 15:46:38 +0100 Subject: [PATCH] simplify visitors --- .../ig/errorhandling/ErrorRethrownInspection.java | 15 ++++----------- .../ThreadDeathRethrownInspection.java | 15 ++++----------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/errorhandling/ErrorRethrownInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/errorhandling/ErrorRethrownInspection.java index 793ad82b4e2f..2310d5380405 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/errorhandling/ErrorRethrownInspection.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/errorhandling/ErrorRethrownInspection.java @@ -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; } diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/errorhandling/ThreadDeathRethrownInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/errorhandling/ThreadDeathRethrownInspection.java index a79b5b2f9e73..130ace79f489 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/errorhandling/ThreadDeathRethrownInspection.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/errorhandling/ThreadDeathRethrownInspection.java @@ -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; }