From 34c855b450609943906766b806d11c3f22d6b9f7 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Fri, 15 Apr 2022 11:37:59 +0200 Subject: [PATCH] [decompiler] add missing cache to annotation loader it was missed during moving the code from intellij repository ^KTIJ-21613 fixed --- .../decompiler/stub/file/KotlinClsStubBuilder.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/analysis/decompiled/decompiler-to-file-stubs/src/org/jetbrains/kotlin/analysis/decompiler/stub/file/KotlinClsStubBuilder.kt b/analysis/decompiled/decompiler-to-file-stubs/src/org/jetbrains/kotlin/analysis/decompiler/stub/file/KotlinClsStubBuilder.kt index 64ebe9f3059..b715c17470c 100644 --- a/analysis/decompiled/decompiler-to-file-stubs/src/org/jetbrains/kotlin/analysis/decompiler/stub/file/KotlinClsStubBuilder.kt +++ b/analysis/decompiled/decompiler-to-file-stubs/src/org/jetbrains/kotlin/analysis/decompiler/stub/file/KotlinClsStubBuilder.kt @@ -31,6 +31,8 @@ import org.jetbrains.kotlin.resolve.constants.ClassLiteralValue import org.jetbrains.kotlin.resolve.constants.ConstantValue import org.jetbrains.kotlin.resolve.constants.KClassValue import org.jetbrains.kotlin.serialization.deserialization.getClassId +import org.jetbrains.kotlin.storage.LockBasedStorageManager +import org.jetbrains.kotlin.storage.StorageManager open class KotlinClsStubBuilder : ClsStubBuilder() { override fun getStubVersion() = ClassFileStubBuilder.STUB_VERSION + KotlinStubVersions.CLASSFILE_STUB_VERSION @@ -128,8 +130,13 @@ private class AnnotationLoaderForClassFileStubBuilder( private val cachedFileContent: ByteArray ) : AbstractBinaryClassAnnotationLoader(kotlinClassFinder) { + private val storage = + LockBasedStorageManager.NO_LOCKS.createMemoizedFunction { kotlinClass -> + loadAnnotationsAndInitializers(kotlinClass) + } + override fun getAnnotationsContainer(binaryClass: KotlinJvmBinaryClass): AnnotationsClassIdContainer { - return loadAnnotationsAndInitializers(binaryClass) + return storage(binaryClass) } override fun getCachedFileContent(kotlinClass: KotlinJvmBinaryClass): ByteArray? {