diff --git a/platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionProfileImpl.java b/platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionProfileImpl.java index 8e96e566f6dd..dc268e654b45 100644 --- a/platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionProfileImpl.java +++ b/platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionProfileImpl.java @@ -341,11 +341,19 @@ public class InspectionProfileImpl extends NewInspectionProfile { }); } + /** + * Warning: Usage of this method is discouraged as if separate tool options are defined for different scopes, it just returns + * the options for the first scope which may lead to unexpected results. Consider using {@link #getInspectionTool(String, PsiElement)} instead. + * + * @param shortName an inspection short name + * @param project a project + * @return an InspectionToolWrapper associated with this tool. + */ @Override @Nullable public InspectionToolWrapper getInspectionTool(@NotNull String shortName, Project project) { final ToolsImpl tools = getToolsOrNull(shortName, project); - return tools != null? tools.getTool() : null; + return tools != null ? tools.getTool() : null; } public InspectionToolWrapper getToolById(@NotNull String id, @NotNull PsiElement element) { diff --git a/platform/analysis-impl/src/com/intellij/codeInspection/ex/ToolsImpl.java b/platform/analysis-impl/src/com/intellij/codeInspection/ex/ToolsImpl.java index 6b9f1e0bbdeb..3642e83d0f6a 100644 --- a/platform/analysis-impl/src/com/intellij/codeInspection/ex/ToolsImpl.java +++ b/platform/analysis-impl/src/com/intellij/codeInspection/ex/ToolsImpl.java @@ -229,6 +229,12 @@ public class ToolsImpl implements Tools { myEnabled = isEnabled; } + /** + * Warning: Usage of this method is discouraged as if separate tool options are defined for different scopes, it just returns + * the options for the first scope which may lead to unexpected results. Consider using {@link #getInspectionTool(PsiElement)} instead. + * + * @return an InspectionToolWrapper associated with this tool. + */ @NotNull @Override public InspectionToolWrapper getTool() {