diff --git a/compiler/frontend.common/src/org/jetbrains/kotlin/KtSourceElement.kt b/compiler/frontend.common/src/org/jetbrains/kotlin/KtSourceElement.kt index d13333d6e93..4334b64dbd3 100644 --- a/compiler/frontend.common/src/org/jetbrains/kotlin/KtSourceElement.kt +++ b/compiler/frontend.common/src/org/jetbrains/kotlin/KtSourceElement.kt @@ -284,9 +284,13 @@ sealed class KtPsiSourceElement(val psi: PsiElement) : KtSourceElement() { override val endOffset: Int get() = psi.textRange.endOffset - override val lighterASTNode by lazy { TreeBackedLighterAST.wrap(psi.node) } + override val lighterASTNode: LighterASTNode by lazy(LazyThreadSafetyMode.PUBLICATION) { + TreeBackedLighterAST.wrap(psi.node) + } - override val treeStructure: FlyweightCapableTreeStructure by lazy { WrappedTreeStructure(psi.containingFile) } + override val treeStructure: FlyweightCapableTreeStructure by lazy(LazyThreadSafetyMode.PUBLICATION) { + WrappedTreeStructure(psi.containingFile) + } internal class WrappedTreeStructure(file: PsiFile) : FlyweightCapableTreeStructure { private val lighterAST = TreeBackedLighterAST(file.node)