mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-26 19:06:24 +07:00
highlight globally unused groovy properties (IDEA-75803)
This commit is contained in:
@@ -447,15 +447,22 @@ public class PostHighlightingPass extends TextEditorHighlightingPass {
|
||||
else if (isImplicitUsage(field, progress)) {
|
||||
return null;
|
||||
}
|
||||
else if (!myRefCountHolder.isReferenced(field) && weAreSureThereAreNoUsages(field, progress, helper)) {
|
||||
if (field instanceof PsiEnumConstant && isEnumValuesMethodUsed(field, progress, helper)) {
|
||||
return null;
|
||||
}
|
||||
else if (isFieldUnused(field, progress, helper)) {
|
||||
return formatUnusedSymbolHighlightInfo("field.is.not.used", field, "fields", myDeadCodeKey, myDeadCodeInfoType);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isFieldUnused(PsiField field, ProgressIndicator progress, GlobalUsageHelper helper) {
|
||||
if (helper.isLocallyUsed(field) || !weAreSureThereAreNoUsages(field, progress, helper)) {
|
||||
return false;
|
||||
}
|
||||
if (field instanceof PsiEnumConstant && isEnumValuesMethodUsed(field, progress, helper)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private HighlightInfo suggestionsToMakeFieldUsed(final PsiField field, final PsiIdentifier identifier, final String message) {
|
||||
HighlightInfo highlightInfo = createUnusedSymbolInfo(identifier, message, HighlightInfoType.UNUSED_SYMBOL);
|
||||
QuickFixAction.registerQuickFixAction(highlightInfo, new RemoveUnusedVariableFix(field), myUnusedSymbolKey);
|
||||
|
||||
Reference in New Issue
Block a user