mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
CatchMayIgnoreException: added option to disable reporting on "ignore(d)" name used
Fixes IDEA-185345 "Catch block may ignore exception" settings considerations
This commit is contained in:
+1
@@ -2239,6 +2239,7 @@ inspection.type.may.be.weakened.add.stop.class.selection.popup=Select stop class
|
||||
inspection.catch.ignores.exception.display.name=Catch block may ignore exception
|
||||
inspection.catch.ignores.exception.option.comments=Do not warn when 'catch' block contains a comment
|
||||
inspection.catch.ignores.exception.option.nonempty=Do not warn when 'catch' block is not empty
|
||||
inspection.catch.ignores.exception.option.ignored.used=Do not warn when exception named 'ignore(d)' is not actually ignored
|
||||
inspection.catch.ignores.exception.used.message='catch' parameter named <code>#ref</code> is used #loc
|
||||
inspection.catch.ignores.exception.empty.message=Empty <code>#ref</code> block #loc
|
||||
inspection.catch.ignores.exception.unused.message=Unused 'catch' parameter <code>#ref</code> #loc
|
||||
|
||||
+3
-1
@@ -37,6 +37,7 @@ public class CatchMayIgnoreExceptionInspection extends AbstractBaseJavaLocalInsp
|
||||
|
||||
public boolean m_ignoreCatchBlocksWithComments = true;
|
||||
public boolean m_ignoreNonEmptyCatchBlock = true;
|
||||
public boolean m_ignoreUsedIgnoredName = false;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
@@ -45,6 +46,7 @@ public class CatchMayIgnoreExceptionInspection extends AbstractBaseJavaLocalInsp
|
||||
panel.addCheckbox(InspectionGadgetsBundle.message("inspection.catch.ignores.exception.option.comments"),
|
||||
"m_ignoreCatchBlocksWithComments");
|
||||
panel.addCheckbox(InspectionGadgetsBundle.message("inspection.catch.ignores.exception.option.nonempty"), "m_ignoreNonEmptyCatchBlock");
|
||||
panel.addCheckbox(InspectionGadgetsBundle.message("inspection.catch.ignores.exception.option.ignored.used"), "m_ignoreUsedIgnoredName");
|
||||
return panel;
|
||||
}
|
||||
|
||||
@@ -69,7 +71,7 @@ public class CatchMayIgnoreExceptionInspection extends AbstractBaseJavaLocalInsp
|
||||
final String parameterName = parameter.getName();
|
||||
if (parameterName == null) return;
|
||||
if (PsiUtil.isIgnoredName(parameterName)) {
|
||||
if (VariableAccessUtils.variableIsUsed(parameter, section)) {
|
||||
if (!m_ignoreUsedIgnoredName && VariableAccessUtils.variableIsUsed(parameter, section)) {
|
||||
holder.registerProblem(identifier, InspectionGadgetsBundle.message("inspection.catch.ignores.exception.used.message"));
|
||||
}
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user