void (PsiCatchSection section) { final PsiParameter parameter = section.getParameter(); if (parameter == null || parameter.isUnnamed()) return; final PsiIdentifier identifier = parameter.getNameIdentifier(); if (identifier == null) return; final String parameterName = parameter.getName(); if (PsiUtil.isIgnoredName(parameterName)) { if (!m_ignoreUsedIgnoredName && VariableAccessUtils.variableIsUsed(parameter, section)) { holder.registerProblem(identifier, InspectionGadgetsBundle.message("inspection.catch.ignores.exception.used.message")); } return; } if (parameterName.equals("cannotHappen")) { // Just ignore parameter named as 'cannotHappen' (this code style appears in OpenJDK source) return; } if ((parameterName.equals("expected") || parameterName.equals("ok")) && TestUtils.isInTestSourceContent(section)) { return; } final PsiElement catchToken = section.getFirstChild(); if (catchToken == null) return; final PsiCodeBlock block = section.getCatchBlock(); if (block == null) return; SuppressForTestsScopeFix fix = SuppressForTestsScopeFix.build(CatchMayIgnoreExceptionInspection.this, section); if (ControlFlowUtils.isEmpty(block, m_ignoreCatchBlocksWithComments, true)) { var renameFix = QuickFixFactory.getInstance().createRenameToIgnoredFix(parameter, false); AddCatchBodyFix addBodyFix = getAddBodyFix(block); holder.registerProblem(catchToken, InspectionGadgetsBundle.message("inspection.catch.ignores.exception.empty.message"), LocalQuickFix.notNullElements(renameFix, addBodyFix, fix)); } else if (!VariableAccessUtils.variableIsUsed(parameter, section)) { if (!m_ignoreNonEmptyCatchBlock && (!m_ignoreCatchBlocksWithComments || PsiTreeUtil.getChildOfType(block, PsiComment.class) == null)) { holder.registerProblem(identifier, InspectionGadgetsBundle.message("inspection.catch.ignores.exception.unused.message"), LocalQuickFix.notNullElements( QuickFixFactory.getInstance().createRenameToIgnoredFix(parameter, false), fix)); } } else { String className = mayIgnoreVMException(parameter, block); if (className != null) { String message = InspectionGadgetsBundle.message("inspection.catch.ignores.exception.vm.ignored.message", className); holder.registerProblem(catchToken, message, LocalQuickFix.notNullElements(fix)); } } }