Drop KtStubElementTypes.FILE
FILE elements are always registered eagerly on parser definition load and should not be mentioned in stubElementTypeHolder interfaces. KtFileElementType.INSTANCE was defined in 2 places, first as getFileNodeType of KotlinParserDefinition and second is KtStubElementTypes. In order to ensure that there are no conflicts in stubs the platform needs to recheck these 2 declarations, and it triggers loading of KtStubElementTypes fields. We do not need to declare FILE element in KtStubElementTypes and may just remove this declaration as excessive. This will delay init of KtStubElementTypes to the moment when Kotlin files appear in indexes. #KT-53781
This commit is contained in:
committed by
Space
parent
584eb9dfa9
commit
298494fa08
@@ -19,8 +19,6 @@ package org.jetbrains.kotlin.psi.stubs.elements;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
|
||||
public interface KtStubElementTypes {
|
||||
KtFileElementType FILE = KtFileElementType.INSTANCE;
|
||||
|
||||
KtClassElementType CLASS = new KtClassElementType("CLASS");
|
||||
KtFunctionElementType FUNCTION = new KtFunctionElementType("FUN");
|
||||
KtPropertyElementType PROPERTY = new KtPropertyElementType("PROPERTY");
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.psi.stubs.KotlinFileStub
|
||||
import org.jetbrains.kotlin.psi.stubs.KotlinImportAliasStub
|
||||
import org.jetbrains.kotlin.psi.stubs.KotlinImportDirectiveStub
|
||||
import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes.FILE
|
||||
import org.jetbrains.kotlin.psi.stubs.elements.KtFileElementType
|
||||
import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes.IMPORT_LIST
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
|
||||
|
||||
@@ -59,7 +59,7 @@ class KotlinFileStubImpl(
|
||||
|
||||
override fun getPackageFqName(): FqName = FqName(packageName)
|
||||
override fun isScript(): Boolean = isScript
|
||||
override fun getType(): IStubFileElementType<KotlinFileStub> = FILE
|
||||
override fun getType(): IStubFileElementType<KotlinFileStub> = KtFileElementType.INSTANCE
|
||||
|
||||
override fun toString(): String = "PsiJetFileStubImpl[" + "package=" + getPackageFqName().asString() + "]"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user