diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/GlobalUsageHelper.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/GlobalUsageHelper.java
index 4f4e3e87c356..cf2b86fd242f 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/GlobalUsageHelper.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/GlobalUsageHelper.java
@@ -31,5 +31,5 @@ public abstract class GlobalUsageHelper {
public abstract boolean shouldCheckUsages(@NotNull PsiMember member);
public abstract boolean isLocallyUsed(@NotNull PsiNamedElement member);
- public abstract boolean shouldIgnoreUsagesInCurrentFile();
+ public abstract boolean isCurrentFileAlreadyChecked();
}
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/PostHighlightingPass.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/PostHighlightingPass.java
index 84e741d7f1dd..815715a494fa 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/PostHighlightingPass.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/PostHighlightingPass.java
@@ -261,7 +261,7 @@ public class PostHighlightingPass extends TextEditorHighlightingPass {
}
@Override
- public boolean shouldIgnoreUsagesInCurrentFile() {
+ public boolean isCurrentFileAlreadyChecked() {
return true;
}
@@ -585,7 +585,7 @@ public class PostHighlightingPass extends TextEditorHighlightingPass {
if (isImplicitUsage(method, progress)) {
return true;
}
- if (!helper.shouldIgnoreUsagesInCurrentFile()) {
+ if (!helper.isCurrentFileAlreadyChecked()) {
return !weAreSureThereAreNoUsages(method, progress, helper);
}
}
@@ -622,7 +622,7 @@ public class PostHighlightingPass extends TextEditorHighlightingPass {
}
PsiSearchHelper.SearchCostResult cheapEnough = PsiSearchHelper.SERVICE.getInstance(project).isCheapEnoughToSearch(name, (GlobalSearchScope)useScope,
- helper.shouldIgnoreUsagesInCurrentFile() ? member.getContainingFile() : null,
+ helper.isCurrentFileAlreadyChecked() ? member.getContainingFile() : null,
progress);
if (cheapEnough == PsiSearchHelper.SearchCostResult.TOO_MANY_OCCURRENCES) return false;
@@ -702,9 +702,11 @@ public class PostHighlightingPass extends TextEditorHighlightingPass {
private static boolean isReallyUsed(PsiClass aClass, ProgressIndicator progress, GlobalUsageHelper helper) {
if (isImplicitUsage(aClass, progress) || helper.isLocallyUsed(aClass)) return true;
- if (aClass.getContainingClass() != null && aClass.hasModifierProperty(PsiModifier.PRIVATE) ||
- aClass.getParent() instanceof PsiDeclarationStatement ||
- aClass instanceof PsiTypeParameter) return false;
+ if (helper.isCurrentFileAlreadyChecked()) {
+ if (aClass.getContainingClass() != null && aClass.hasModifierProperty(PsiModifier.PRIVATE) ||
+ aClass.getParent() instanceof PsiDeclarationStatement ||
+ aClass instanceof PsiTypeParameter) return false;
+ }
return !weAreSureThereAreNoUsages(aClass, progress, helper);
}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/local/GroovyPostHighlightingPass.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/local/GroovyPostHighlightingPass.java
index 46b37bb78a8d..85ebd3864b35 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/local/GroovyPostHighlightingPass.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/local/GroovyPostHighlightingPass.java
@@ -87,7 +87,7 @@ public class GroovyPostHighlightingPass extends TextEditorHighlightingPass {
}
final UnusedDeclarationInspection deadCodeInspection = (UnusedDeclarationInspection)profile.getInspectionTool(UnusedDeclarationInspection.SHORT_NAME, myFile);
final GlobalUsageHelper usageHelper = new GlobalUsageHelper() {
- public boolean shouldIgnoreUsagesInCurrentFile() {
+ public boolean isCurrentFileAlreadyChecked() {
return false;
}
diff --git a/plugins/groovy/testdata/highlighting/GloballyUnusedSymbols.groovy b/plugins/groovy/testdata/highlighting/GloballyUnusedSymbols.groovy
index af47b7500098..2d98c8e74006 100644
--- a/plugins/groovy/testdata/highlighting/GloballyUnusedSymbols.groovy
+++ b/plugins/groovy/testdata/highlighting/GloballyUnusedSymbols.groovy
@@ -1,8 +1,8 @@
class UnusedClass {}
-class Bar {
+class BarUnused> {
int unusedProperty = 2
- int usedProperty = 39
+ T usedProperty = null
int usedProperty2 = 39
int usedProperty3 = 39
def unusedMethod() {}