ClsWrapperStubPsiFactory can be a singleton
This commit is contained in:
@@ -31,8 +31,12 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class ClsWrapperStubPsiFactory extends StubPsiFactory {
|
||||
public static final Key<LightElementOrigin> ORIGIN = Key.create("ORIGIN");
|
||||
public static final ClsWrapperStubPsiFactory INSTANCE = new ClsWrapperStubPsiFactory();
|
||||
|
||||
private final StubPsiFactory delegate = new ClsStubPsiFactory();
|
||||
|
||||
private ClsWrapperStubPsiFactory() { }
|
||||
|
||||
@Nullable
|
||||
public static LightMemberOriginForDeclaration getMemberOrigin(@NotNull PsiMember member) {
|
||||
if (member instanceof ClsRepositoryPsiElement<?>) {
|
||||
|
||||
@@ -127,7 +127,7 @@ abstract class LightClassDataProvider<T : WithFileStubAndExtraDiagnostics>(
|
||||
|
||||
private fun createJavaFileStub(packageFqName: FqName, files: Collection<KtFile>): PsiJavaFileStub {
|
||||
val javaFileStub = PsiJavaFileStubImpl(packageFqName.asString(), true)
|
||||
javaFileStub.psiFactory = ClsWrapperStubPsiFactory()
|
||||
javaFileStub.psiFactory = ClsWrapperStubPsiFactory.INSTANCE
|
||||
|
||||
val manager = PsiManager.getInstance(project)
|
||||
|
||||
|
||||
+1
-1
@@ -348,7 +348,7 @@ class IDELightClassGenerationSupport(private val project: Project) : LightClassG
|
||||
correspondingClassOrObject: KtClassOrObject?
|
||||
): ClsClassImpl? {
|
||||
val javaFileStub = ClsJavaStubByVirtualFileCache.getInstance(project).get(classFile) ?: return null
|
||||
javaFileStub.psiFactory = ClsWrapperStubPsiFactory()
|
||||
javaFileStub.psiFactory = ClsWrapperStubPsiFactory.INSTANCE
|
||||
val manager = PsiManager.getInstance(mirrorFile.project)
|
||||
val fakeFile = object : ClsFileImpl(ClassFileViewProvider(manager, classFile)) {
|
||||
override fun getNavigationElement(): PsiElement {
|
||||
|
||||
Reference in New Issue
Block a user