From 02bb17ad2b70b5a7abe9675600b3db2e614e9be3 Mon Sep 17 00:00:00 2001 From: Dmitry Batkovich Date: Thu, 27 Oct 2016 16:31:05 +0300 Subject: [PATCH] javac ast indices: do not hide find usages in libraries --- .../backwardRefs/CompilerReferenceServiceImpl.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/java/compiler/impl/src/com/intellij/compiler/backwardRefs/CompilerReferenceServiceImpl.java b/java/compiler/impl/src/com/intellij/compiler/backwardRefs/CompilerReferenceServiceImpl.java index e40ae248b4d8..ce0c9994bc70 100644 --- a/java/compiler/impl/src/com/intellij/compiler/backwardRefs/CompilerReferenceServiceImpl.java +++ b/java/compiler/impl/src/com/intellij/compiler/backwardRefs/CompilerReferenceServiceImpl.java @@ -242,7 +242,7 @@ public class CompilerReferenceServiceImpl extends CompilerReferenceService imple TIntHashSet referentFileIds = getReferentFileIds(element); if (referentFileIds == null) return null; - return getScopeRestrictedByFileTypes(new ScopeWithoutReferencesOnCompilation(referentFileIds).intersectWith(notScope(myDirtyModulesHolder.getDirtyScope())), + return getScopeRestrictedByFileTypes(new ScopeWithoutReferencesOnCompilation(referentFileIds, myProjectFileIndex).intersectWith(notScope(myDirtyModulesHolder.getDirtyScope())), myFileTypes.toArray(new FileType[myFileTypes.size()])); } @@ -384,14 +384,16 @@ public class CompilerReferenceServiceImpl extends CompilerReferenceService imple private static class ScopeWithoutReferencesOnCompilation extends GlobalSearchScope { private final TIntHashSet myReferentIds; + private final ProjectFileIndex myIndex; - private ScopeWithoutReferencesOnCompilation(TIntHashSet ids) { + private ScopeWithoutReferencesOnCompilation(TIntHashSet ids, ProjectFileIndex index) { myReferentIds = ids; + myIndex = index; } @Override public boolean contains(@NotNull VirtualFile file) { - return !(file instanceof VirtualFileWithId) || !myReferentIds.contains(((VirtualFileWithId)file).getId()); + return file instanceof VirtualFileWithId && myIndex.isInSourceContent(file) && !myReferentIds.contains(((VirtualFileWithId)file).getId()); } @Override