From f3a104f6710286f29c97dcb214073d9a83517022 Mon Sep 17 00:00:00 2001 From: Alexander Zolotov Date: Mon, 1 Oct 2018 19:14:25 +0300 Subject: [PATCH] Do not initialize all Java element types on components instantiation we don't need java elements on the IDE start --- .../src/com/intellij/psi/impl/JavaSimplePropertyIndex.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/java/java-indexing-impl/src/com/intellij/psi/impl/JavaSimplePropertyIndex.kt b/java/java-indexing-impl/src/com/intellij/psi/impl/JavaSimplePropertyIndex.kt index 6c846ad403d4..fd805d1137db 100644 --- a/java/java-indexing-impl/src/com/intellij/psi/impl/JavaSimplePropertyIndex.kt +++ b/java/java-indexing-impl/src/com/intellij/psi/impl/JavaSimplePropertyIndex.kt @@ -33,7 +33,6 @@ import java.io.DataOutput private val indexId = ID.create("java.simple.property") private val log = Logger.getInstance(JavaSimplePropertyIndex::class.java) -private val allowedExpressions = TokenSet.create(ElementType.REFERENCE_EXPRESSION, ElementType.THIS_EXPRESSION, ElementType.SUPER_EXPRESSION) fun getFieldOfGetter(method: PsiMethodImpl): PsiField? = resolveFieldFromIndexValue(method, true) @@ -64,6 +63,10 @@ private fun resolveFieldFromIndexValue(method: PsiMethodImpl, isGetter: Boolean) data class PropertyIndexValue(val propertyRefText: String, val getter: Boolean) class JavaSimplePropertyIndex : FileBasedIndexExtension(), PsiDependentIndex { + private val allowedExpressions by lazy { + TokenSet.create(ElementType.REFERENCE_EXPRESSION, ElementType.THIS_EXPRESSION, ElementType.SUPER_EXPRESSION) + } + override fun getIndexer(): DataIndexer = DataIndexer { inputData -> val result = ContainerUtil.newHashMap() val tree = (inputData as FileContentImpl).lighterASTForPsiDependentIndex