[java] Add stub index for unnamed classes

#IDEA-331209

GitOrigin-RevId: bf52092b67108e81fc148f7e223ac802f0214fdf
This commit is contained in:
Louis Vignier
2023-09-28 17:56:48 +02:00
committed by intellij-monorepo-bot
parent e9a1218df7
commit 619640a0ca
4 changed files with 47 additions and 0 deletions

View File

@@ -48,6 +48,7 @@
<stubIndex implementation="com.intellij.psi.impl.java.stubs.index.JavaFieldNameIndex"/>
<stubIndex implementation="com.intellij.psi.impl.java.stubs.index.JavaAnonymousClassBaseRefOccurenceIndex"/>
<stubIndex implementation="com.intellij.psi.impl.java.stubs.index.JavaAnnotationIndex"/>
<stubIndex implementation="com.intellij.psi.impl.java.stubs.index.JavaUnnamedClassIndex"/>
<java.shortNamesCache implementation="com.intellij.psi.impl.PsiShortNamesCacheImpl"/>
<java.staticMethodNamesCache implementation="com.intellij.psi.impl.JavaStaticMethodNameCacheImpl" order="first"/>
<projectService serviceInterface="com.intellij.psi.search.PsiShortNamesCache"

View File

@@ -0,0 +1,33 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.psi.impl.java.stubs.index;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiUnnamedClass;
import com.intellij.psi.stubs.StringStubIndexExtension;
import com.intellij.psi.stubs.StubIndex;
import com.intellij.psi.stubs.StubIndexKey;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
public class JavaUnnamedClassIndex extends StringStubIndexExtension<PsiUnnamedClass> {
private static final JavaUnnamedClassIndex ourInstance = new JavaUnnamedClassIndex();
public static JavaUnnamedClassIndex getInstance() {
return ourInstance;
}
@Override
public int getVersion() {
return super.getVersion();
}
@Override
public @NotNull StubIndexKey<String, PsiUnnamedClass> getKey() {
return JavaStubIndexKeys.UNNAMED_CLASSES;
}
public Collection<String> getAllClasses(@NotNull Project project) {
return StubIndex.getInstance().getAllKeys(getKey(), project);
}
}