void (@NotNull PsiBreakStatement statement) { final PsiIdentifier labelIdentifier = statement.getLabelIdentifier(); if (labelIdentifier == null) { return; } final String labelText = labelIdentifier.getText(); if (labelText == null || labelText.isEmpty()) { return; } final PsiStatement exitedStatement = statement.findExitedStatement(); if (exitedStatement == null) { return; } final PsiStatement labelEnabledParent = PsiTreeUtil.getParentOfType(statement, PsiForStatement.class, PsiDoWhileStatement.class, PsiForeachStatement.class, PsiWhileStatement.class, PsiSwitchStatement.class); if (labelEnabledParent == null) { return; } if (exitedStatement.equals(labelEnabledParent)) { registerError(labelIdentifier); } }