alternative suppress id for global inspections (IDEA-154071)

This commit is contained in:
Anna.Kozlova
2016-07-20 09:29:54 +02:00
parent e7b814c549
commit a1b30986af
5 changed files with 10 additions and 5 deletions
@@ -32,6 +32,7 @@ public class UnusedSymbolLocalInspectionBase extends BaseJavaLocalInspectionTool
@NonNls public static final String SHORT_NAME = HighlightInfoType.UNUSED_SYMBOL_SHORT_NAME;
@NonNls public static final String DISPLAY_NAME = HighlightInfoType.UNUSED_SYMBOL_DISPLAY_NAME;
@NonNls public static final String UNUSED_PARAMETERS_SHORT_NAME = "UnusedParameters";
@NonNls public static final String UNUSED_ID = "unused";
public boolean LOCAL_VARIABLE = true;
public boolean FIELD = true;
@@ -126,7 +127,7 @@ public class UnusedSymbolLocalInspectionBase extends BaseJavaLocalInspectionTool
@NotNull
@NonNls
public String getID() {
return "unused";
return UNUSED_ID;
}
@Override
@@ -193,7 +193,7 @@ public class UnusedParametersInspection extends GlobalJavaBatchInspectionTool {
clearUsedParameters(refMethod, result, checkDeep);
for (RefParameter parameter : result) {
if (parameter != null && !((RefElementImpl)parameter).isSuppressed(UnusedSymbolLocalInspectionBase.UNUSED_PARAMETERS_SHORT_NAME)) {
if (parameter != null && !((RefElementImpl)parameter).isSuppressed(UnusedSymbolLocalInspectionBase.UNUSED_PARAMETERS_SHORT_NAME, UnusedSymbolLocalInspectionBase.UNUSED_ID)) {
res.add(parameter);
}
}
@@ -315,6 +315,6 @@ public class UnusedParametersInspection extends GlobalJavaBatchInspectionTool {
@Nullable
@Override
public String getAlternativeID() {
return "unused";
return UnusedSymbolLocalInspectionBase.UNUSED_ID;
}
}
@@ -2,4 +2,8 @@ public class Test {
public void foo(@SuppressWarnings("UnusedParameters") boolean b) {
}
public void foo(@SuppressWarnings("unused") boolean b) {
}
}
@@ -209,7 +209,7 @@ public class GlobalInspectionContextBase extends UserDataHolderBase implements G
}
public boolean isToCheckMember(@NotNull RefElement owner, @NotNull InspectionProfileEntry tool) {
return isToCheckFile(((RefElementImpl)owner).getContainingFile(), tool) && !((RefElementImpl)owner).isSuppressed(tool.getShortName());
return isToCheckFile(((RefElementImpl)owner).getContainingFile(), tool) && !((RefElementImpl)owner).isSuppressed(tool.getShortName(), tool.getAlternativeID());
}
public boolean isToCheckFile(PsiFile file, @NotNull InspectionProfileEntry tool) {
@@ -42,7 +42,7 @@ public class GlobalInspectionContextUtil {
public static boolean isToCheckMember(@NotNull RefElement owner, @NotNull InspectionProfileEntry tool, Tools tools, ProfileManager profileManager) {
return isToCheckFile(((RefElementImpl)owner).getContainingFile(), tool, tools, profileManager) && !((RefElementImpl)owner).isSuppressed(tool.getShortName());
return isToCheckFile(((RefElementImpl)owner).getContainingFile(), tool, tools, profileManager) && !((RefElementImpl)owner).isSuppressed(tool.getShortName(), tool.getAlternativeID());
}
public static boolean isToCheckFile(PsiFile file, @NotNull InspectionProfileEntry tool, Tools tools, ProfileManager profileManager) {