Merge branch 'db/implicit-to-string'
authorDmitry Batkovich <dmitry.batkovich@jetbrains.com>
Tue, 24 Apr 2018 13:08:53 +0000 (16:08 +0300)
committerDmitry Batkovich <dmitry.batkovich@jetbrains.com>
Tue, 24 Apr 2018 13:08:53 +0000 (16:08 +0300)
# Conflicts:
# java/compiler/impl/src/com/intellij/compiler/backwardRefs/CompilerReferenceServiceImpl.java
# java/java-indexing-impl/src/com/intellij/compiler/CompilerReferenceService.java
# jps/jps-builders-6/src/org/jetbrains/jps/javac/ast/JavacTreeRefScanner.java
# jps/jps-builders/testSrc/org/jetbrains/references/ReferenceIndexTest.kt

1  2 
java/compiler/impl/src/com/intellij/compiler/backwardRefs/CompilerReferenceReader.java
java/compiler/impl/src/com/intellij/compiler/backwardRefs/CompilerReferenceServiceImpl.java
java/java-analysis-impl/src/com/intellij/find/findUsages/JavaFindUsagesHelper.java
java/java-indexing-impl/src/com/intellij/compiler/CompilerReferenceService.java
java/java-tests/testSrc/com/intellij/java/psi/search/FindUsagesTest.java
jps/jps-builders-6/src/org/jetbrains/jps/javac/ast/JavacTreeRefScanner.java
jps/jps-builders/src/org/jetbrains/jps/javac/ast/InProcessRefCollectorCompilerToolExtension.java
jps/jps-builders/testSrc/org/jetbrains/references/ReferenceIndexTest.kt
platform/platform-resources-en/src/messages/FindBundle.properties

index 4c74a75e2a18a4c5503069b607559694a1421d76,5ec4b78a3dd777fb5a51e8a3139edb75268951d2..e88404230c711466fe40d1b2fcf150d6ec1c60e1
@@@ -527,10 -545,22 +543,22 @@@ public class CompilerReferenceServiceIm
  
    @Nullable
    private TIntHashSet getReferentFileIds(@NotNull PsiElement element) {
-     final CompilerElementInfo compilerElementInfo = asCompilerElements(element, true, true);
+     return getReferentFileIds(element, true, (ref, elementPlace) -> myReader.findReferentFileIds(ref, elementPlace == ElementPlace.SRC));
+   }
+   @Nullable
+   private TIntHashSet getReferentFileIdsViaImplicitToString(@NotNull PsiElement element) {
+     return getReferentFileIds(element, false, (ref, elementPlace) -> myReader.findFileIdsWithImplicitToString(ref));
+   }
+   @Nullable
+   private TIntHashSet getReferentFileIds(@NotNull PsiElement element,
+                                          boolean buildHierarchyForLibraryElements,
+                                          @NotNull ReferentFileSearcher referentFileSearcher) {
+     final CompilerElementInfo compilerElementInfo = asCompilerElements(element, buildHierarchyForLibraryElements, true);
      if (compilerElementInfo == null) return null;
  
 -    myReadDataLock.lock();
 +    if (!myReadDataLock.tryLock()) return null;
      try {
        if (myReader == null) return null;
        TIntHashSet referentFileIds = new TIntHashSet();
index c89984f19927563bb0dc8b9989d85836078af2a9,2aa9cce732141d61150624b403eb025611076979..63923db7970c94605d186a9d9a6fcb0a9b89ebda
@@@ -180,8 -180,20 +180,24 @@@ class ReferenceIndexTest : ReferenceInd
      assertIndexOnRebuild("Foo.java")
    }
  
 +  fun testNestedAnonymouses() {
 +    assertIndexOnRebuild("Anonymouses.java", "Classes.java")
 +  }
++
+   fun testImplicitToString() {
+     assertIndexOnRebuild("Foo.java")
+   }
+   fun testImplicitToStringPrimitives() {
+     assertIndexOnRebuild("Foo.java")
+   }
+   fun testImplicitToStringLongObject() {
+     assertIndexOnRebuild("Foo.java")
+   }
+   fun testImplicitToStringHierarchy() {
+     assertIndexOnRebuild("Foo.java")
+   }
  }