ClsWrapperStubPsiFactory can be a singleton

This commit is contained in:
Dmitry Jemerov
2016-07-12 14:57:42 +02:00
parent 87387d030f
commit 5201fc171b
3 changed files with 6 additions and 2 deletions
@@ -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)