From 48368e6169604f49edd14f38e67fe08d9e685a63 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Fri, 25 Feb 2005 20:34:23 +0300 Subject: [PATCH] Fixed bug when UnnecessaryLabel inspections never fire --- .../UnnecessaryLabelOnBreakStatementInspection.java | 8 ++------ .../UnnecessaryLabelOnContinueStatementInspection.java | 8 ++------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/verbose/UnnecessaryLabelOnBreakStatementInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/verbose/UnnecessaryLabelOnBreakStatementInspection.java index 643a2211a2b1..86ab24d731c1 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/verbose/UnnecessaryLabelOnBreakStatementInspection.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/verbose/UnnecessaryLabelOnBreakStatementInspection.java @@ -105,13 +105,9 @@ public class UnnecessaryLabelOnBreakStatementInspection extends StatementInspect if (currentContainer == null) { return; } - final PsiElement containerParent = currentContainer.getParent(); - if (exitedStatement.equals(containerParent)) { - return; + if (exitedStatement.equals(currentContainer)) { + registerStatementError(statement); } - registerStatementError(statement); } - } - } diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/verbose/UnnecessaryLabelOnContinueStatementInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/verbose/UnnecessaryLabelOnContinueStatementInspection.java index c0cb9404c35d..43970964e47e 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/verbose/UnnecessaryLabelOnContinueStatementInspection.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/verbose/UnnecessaryLabelOnContinueStatementInspection.java @@ -98,13 +98,9 @@ public class UnnecessaryLabelOnContinueStatementInspection extends StatementInsp if (currentContainer == null) { return; } - final PsiElement containerParent = currentContainer.getParent(); - if (continuedStatement.equals(containerParent)) { - return; + if (continuedStatement.equals(currentContainer)) { + registerStatementError(statement); } - registerStatementError(statement); } - } - }