use StubIndex.getElements() with required class specified to diagnose CCE problems when using stub index

This commit is contained in:
Dmitry Jemerov
2016-01-11 16:29:41 +01:00
parent 8d22eafe3f
commit d0a4e542af
21 changed files with 44 additions and 21 deletions
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.idea.stubindex;
import com.intellij.openapi.project.Project;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.stubs.StringStubIndexExtension;
import com.intellij.psi.stubs.StubIndex;
import com.intellij.psi.stubs.StubIndexKey;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.psi.KtAnnotationEntry;
@@ -45,7 +46,7 @@ public class KotlinAnnotationsIndex extends StringStubIndexExtension<KtAnnotatio
@NotNull
@Override
public Collection<KtAnnotationEntry> get(@NotNull String s, @NotNull Project project, @NotNull GlobalSearchScope scope) {
return super.get(s, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project));
return StubIndex.getElements(KEY, s, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project), KtAnnotationEntry.class);
}
@Override
@@ -19,8 +19,10 @@ package org.jetbrains.kotlin.idea.stubindex;
import com.intellij.openapi.project.Project;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.stubs.StringStubIndexExtension;
import com.intellij.psi.stubs.StubIndex;
import com.intellij.psi.stubs.StubIndexKey;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.psi.KtClass;
import org.jetbrains.kotlin.psi.KtClassOrObject;
import java.util.Collection;
@@ -46,6 +48,6 @@ public class KotlinClassShortNameIndex extends StringStubIndexExtension<KtClassO
@NotNull
@Override
public Collection<KtClassOrObject> get(@NotNull String s, @NotNull Project project, @NotNull GlobalSearchScope scope) {
return super.get(s, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project));
return StubIndex.getElements(KEY, s, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project), KtClassOrObject.class);
}
}
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.idea.stubindex;
import com.intellij.openapi.project.Project;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.stubs.StringStubIndexExtension;
import com.intellij.psi.stubs.StubIndex;
import com.intellij.psi.stubs.StubIndexKey;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.psi.KtFile;
@@ -46,6 +47,6 @@ public class KotlinExactPackagesIndex extends StringStubIndexExtension<KtFile> {
@NotNull
@Override
public Collection<KtFile> get(@NotNull String fqName, @NotNull Project project, @NotNull GlobalSearchScope scope) {
return super.get(fqName, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project));
return StubIndex.getElements(KEY, fqName, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project), KtFile.class);
}
}
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.idea.stubindex
import com.intellij.openapi.project.Project
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.psi.stubs.StringStubIndexExtension
import com.intellij.psi.stubs.StubIndex
import com.intellij.psi.stubs.StubIndexKey
import org.jetbrains.kotlin.psi.KtFile
@@ -26,7 +27,7 @@ class KotlinFileFacadeClassByPackageIndex private constructor() : StringStubInde
override fun getKey(): StubIndexKey<String, KtFile> = KEY
override fun get(key: String, project: Project, scope: GlobalSearchScope) =
super.get(key, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project))
StubIndex.getElements(KEY, key, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project), KtFile::class.java)
companion object {
private val KEY = KotlinIndexUtil.createIndexKey(KotlinFileFacadeClassByPackageIndex::class.java)
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.idea.stubindex
import com.intellij.openapi.project.Project
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.psi.stubs.StringStubIndexExtension
import com.intellij.psi.stubs.StubIndex
import com.intellij.psi.stubs.StubIndexKey
import org.jetbrains.kotlin.psi.KtFile
@@ -26,7 +27,7 @@ class KotlinFileFacadeFqNameIndex private constructor() : StringStubIndexExtensi
override fun getKey(): StubIndexKey<String, KtFile> = KEY
override fun get(key: String, project: Project, scope: GlobalSearchScope) =
super.get(key, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project))
StubIndex.getElements(KEY, key, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project), KtFile::class.java)
companion object {
private val KEY = KotlinIndexUtil.createIndexKey(KotlinFileFacadeFqNameIndex::class.java)
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.idea.stubindex
import com.intellij.openapi.project.Project
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.psi.stubs.StringStubIndexExtension
import com.intellij.psi.stubs.StubIndex
import com.intellij.psi.stubs.StubIndexKey
import org.jetbrains.kotlin.psi.KtFile
@@ -26,7 +27,7 @@ class KotlinFileFacadeShortNameIndex private constructor() : StringStubIndexExte
override fun getKey(): StubIndexKey<String, KtFile> = KEY
override fun get(key: String, project: Project, scope: GlobalSearchScope) =
super.get(key, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project))
StubIndex.getElements(KEY, key, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project), KtFile::class.java)
companion object {
private val KEY = KotlinIndexUtil.createIndexKey(KotlinFileFacadeShortNameIndex::class.java)
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.idea.stubindex
import com.intellij.openapi.project.Project
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.psi.stubs.StringStubIndexExtension
import com.intellij.psi.stubs.StubIndex
import com.intellij.psi.stubs.StubIndexKey
import org.jetbrains.kotlin.psi.KtFile
@@ -27,7 +28,7 @@ class KotlinFilePartClassIndex private constructor() : StringStubIndexExtension<
override fun getKey(): StubIndexKey<String, KtFile> = KEY
override fun get(key: String, project: Project, scope: GlobalSearchScope) =
super.get(key, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project))
StubIndex.getElements(KEY, key, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project), KtFile::class.java)
companion object {
private val KEY = KotlinIndexUtil.createIndexKey(KotlinFilePartClassIndex::class.java)
@@ -19,8 +19,10 @@ package org.jetbrains.kotlin.idea.stubindex;
import com.intellij.openapi.project.Project;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.stubs.StringStubIndexExtension;
import com.intellij.psi.stubs.StubIndex;
import com.intellij.psi.stubs.StubIndexKey;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.psi.KtClass;
import org.jetbrains.kotlin.psi.KtClassOrObject;
import java.util.Collection;
@@ -46,6 +48,6 @@ public class KotlinFullClassNameIndex extends StringStubIndexExtension<KtClassOr
@NotNull
@Override
public Collection<KtClassOrObject> get(@NotNull String fqName, @NotNull Project project, @NotNull GlobalSearchScope scope) {
return super.get(fqName, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project));
return StubIndex.getElements(KEY, fqName, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project), KtClassOrObject.class);
}
}
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.idea.stubindex;
import com.intellij.openapi.project.Project;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.stubs.StringStubIndexExtension;
import com.intellij.psi.stubs.StubIndex;
import com.intellij.psi.stubs.StubIndexKey;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.psi.KtNamedFunction;
@@ -45,6 +46,6 @@ public class KotlinFunctionShortNameIndex extends StringStubIndexExtension<KtNam
@NotNull
@Override
public Collection<KtNamedFunction> get(@NotNull String s, @NotNull Project project, @NotNull GlobalSearchScope scope) {
return super.get(s, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project));
return StubIndex.getElements(KEY, s, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project), KtNamedFunction.class);
}
}
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.idea.stubindex
import com.intellij.openapi.project.Project
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.psi.stubs.StringStubIndexExtension
import com.intellij.psi.stubs.StubIndex
import com.intellij.psi.stubs.StubIndexKey
import org.jetbrains.kotlin.psi.KtFile
@@ -27,7 +28,7 @@ class KotlinMultifileClassPartIndex private constructor() : StringStubIndexExten
override fun getKey(): StubIndexKey<String, KtFile> = KEY
override fun get(key: String, project: Project, scope: GlobalSearchScope) =
super.get(key, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project))
StubIndex.getElements(KEY, key, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project), KtFile::class.java)
companion object {
private val KEY = KotlinIndexUtil.createIndexKey(KotlinMultifileClassPartIndex::class.java)
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.idea.stubindex;
import com.intellij.openapi.project.Project;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.stubs.StringStubIndexExtension;
import com.intellij.psi.stubs.StubIndex;
import com.intellij.psi.stubs.StubIndexKey;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.psi.KtNamedFunction;
@@ -45,6 +46,6 @@ public class KotlinProbablyNothingFunctionShortNameIndex extends StringStubIndex
@NotNull
@Override
public Collection<KtNamedFunction> get(@NotNull String s, @NotNull Project project, @NotNull GlobalSearchScope scope) {
return super.get(s, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project));
return StubIndex.getElements(KEY, s, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project), KtNamedFunction.class);
}
}
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.idea.stubindex;
import com.intellij.openapi.project.Project;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.stubs.StringStubIndexExtension;
import com.intellij.psi.stubs.StubIndex;
import com.intellij.psi.stubs.StubIndexKey;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.psi.KtProperty;
@@ -45,6 +46,6 @@ public class KotlinProbablyNothingPropertyShortNameIndex extends StringStubIndex
@NotNull
@Override
public Collection<KtProperty> get(@NotNull String s, @NotNull Project project, @NotNull GlobalSearchScope scope) {
return super.get(s, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project));
return StubIndex.getElements(KEY, s, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project), KtProperty.class);
}
}
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.idea.stubindex;
import com.intellij.openapi.project.Project;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.stubs.StringStubIndexExtension;
import com.intellij.psi.stubs.StubIndex;
import com.intellij.psi.stubs.StubIndexKey;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.psi.KtProperty;
@@ -45,6 +46,6 @@ public class KotlinPropertyShortNameIndex extends StringStubIndexExtension<KtPro
@NotNull
@Override
public Collection<KtProperty> get(@NotNull String s, @NotNull Project project, @NotNull GlobalSearchScope scope) {
return super.get(s, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project));
return StubIndex.getElements(KEY, s, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project), KtProperty.class);
}
}
@@ -19,13 +19,14 @@ package org.jetbrains.kotlin.idea.stubindex
import com.intellij.openapi.project.Project
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.psi.stubs.StringStubIndexExtension
import com.intellij.psi.stubs.StubIndex
import org.jetbrains.kotlin.psi.KtScript
class KotlinScriptFqnIndex private constructor() : StringStubIndexExtension<KtScript>() {
override fun getKey() = KEY
override fun get(fqName: String, project: Project, scope: GlobalSearchScope): Collection<KtScript> {
return super.get(fqName, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project))
return StubIndex.getElements(KEY, fqName, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project), KtScript::class.java)
}
companion object {
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.idea.stubindex;
import com.intellij.openapi.project.Project;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.stubs.StringStubIndexExtension;
import com.intellij.psi.stubs.StubIndex;
import com.intellij.psi.stubs.StubIndexKey;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.psi.KtClassOrObject;
@@ -46,6 +47,6 @@ public class KotlinSuperClassIndex extends StringStubIndexExtension<KtClassOrObj
@NotNull
@Override
public Collection<KtClassOrObject> get(@NotNull String s, @NotNull Project project, @NotNull GlobalSearchScope scope) {
return super.get(s, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project));
return StubIndex.getElements(KEY, s, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project), KtClassOrObject.class);
}
}
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.idea.stubindex;
import com.intellij.openapi.project.Project;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.stubs.StringStubIndexExtension;
import com.intellij.psi.stubs.StubIndex;
import com.intellij.psi.stubs.StubIndexKey;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.psi.KtClassOrObject;
@@ -45,6 +46,6 @@ public class KotlinTopLevelClassByPackageIndex extends StringStubIndexExtension<
@NotNull
@Override
public Collection<KtClassOrObject> get(@NotNull String fqName, @NotNull Project project, @NotNull GlobalSearchScope scope) {
return super.get(fqName, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project));
return StubIndex.getElements(KEY, fqName, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project), KtClassOrObject.class);
}
}
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.idea.stubindex
import com.intellij.openapi.project.Project
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.psi.stubs.StringStubIndexExtension
import com.intellij.psi.stubs.StubIndex
import org.jetbrains.kotlin.psi.KtCallableDeclaration
class KotlinTopLevelExtensionsByReceiverTypeIndex private constructor() : StringStubIndexExtension<KtCallableDeclaration>() {
@@ -26,7 +27,7 @@ class KotlinTopLevelExtensionsByReceiverTypeIndex private constructor() : String
override fun getKey() = KEY
override fun get(s: String, project: Project, scope: GlobalSearchScope)
= super.get(s, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project))
= StubIndex.getElements(KEY, s, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project), KtCallableDeclaration::class.java)
companion object {
private val KEY = KotlinIndexUtil.createIndexKey<String, KtCallableDeclaration>(KotlinTopLevelExtensionsByReceiverTypeIndex::class.java)
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.idea.stubindex;
import com.intellij.openapi.project.Project;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.stubs.StringStubIndexExtension;
import com.intellij.psi.stubs.StubIndex;
import com.intellij.psi.stubs.StubIndexKey;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.psi.KtNamedFunction;
@@ -45,6 +46,6 @@ public class KotlinTopLevelFunctionByPackageIndex extends StringStubIndexExtensi
@NotNull
@Override
public Collection<KtNamedFunction> get(@NotNull String fqName, @NotNull Project project, @NotNull GlobalSearchScope scope) {
return super.get(fqName, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project));
return StubIndex.getElements(KEY, fqName, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project), KtNamedFunction.class);
}
}
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.idea.stubindex;
import com.intellij.openapi.project.Project;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.stubs.StringStubIndexExtension;
import com.intellij.psi.stubs.StubIndex;
import com.intellij.psi.stubs.StubIndexKey;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.psi.KtNamedFunction;
@@ -49,6 +50,6 @@ public class KotlinTopLevelFunctionFqnNameIndex extends StringStubIndexExtension
@NotNull
@Override
public Collection<KtNamedFunction> get(@NotNull String s, @NotNull Project project, @NotNull GlobalSearchScope scope) {
return super.get(s, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project));
return StubIndex.getElements(KEY, s, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project), KtNamedFunction.class);
}
}
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.idea.stubindex;
import com.intellij.openapi.project.Project;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.stubs.StringStubIndexExtension;
import com.intellij.psi.stubs.StubIndex;
import com.intellij.psi.stubs.StubIndexKey;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.psi.KtProperty;
@@ -45,6 +46,6 @@ public class KotlinTopLevelPropertyByPackageIndex extends StringStubIndexExtensi
@NotNull
@Override
public Collection<KtProperty> get(@NotNull String fqName, @NotNull Project project, @NotNull GlobalSearchScope scope) {
return super.get(fqName, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project));
return StubIndex.getElements(KEY, fqName, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project), KtProperty.class);
}
}
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.idea.stubindex;
import com.intellij.openapi.project.Project;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.stubs.StringStubIndexExtension;
import com.intellij.psi.stubs.StubIndex;
import com.intellij.psi.stubs.StubIndexKey;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.psi.KtProperty;
@@ -46,6 +47,6 @@ public class KotlinTopLevelPropertyFqnNameIndex extends StringStubIndexExtension
@NotNull
@Override
public Collection<KtProperty> get(@NotNull String s, @NotNull Project project, @NotNull GlobalSearchScope scope) {
return super.get(s, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project));
return StubIndex.getElements(KEY, s, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project), KtProperty.class);
}
}