From e0a834dee676c437466bead3ee455a9de47f8a19 Mon Sep 17 00:00:00 2001 From: Stanislav Erokhin Date: Tue, 27 Apr 2021 11:13:14 +0200 Subject: [PATCH] Fix binary compatibility with AS Arctic Fox C14 --- .../kotlin/codegen/state/GenerationState.kt | 1 + .../codegen/state/IncompatibleClassTracker.kt | 17 +++++++++++++++++ .../kotlin/codegen/state/KotlinTypeMapper.kt | 3 +++ .../kotlin/idea/core/KotlinIndicesHelper.kt | 9 +++++++++ 4 files changed, 30 insertions(+) create mode 100644 compiler/backend/src/org/jetbrains/kotlin/codegen/state/IncompatibleClassTracker.kt diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt index 5b3cf95026a..f0b3fef4c90 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt @@ -245,6 +245,7 @@ class GenerationState private constructor( this.moduleName, languageVersionSettings, useOldManglingSchemeForFunctionsWithInlineClassesInSignatures, + IncompatibleClassTracker.DoNothing, target, isIrBackend ) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/IncompatibleClassTracker.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/IncompatibleClassTracker.kt new file mode 100644 index 00000000000..1001a560cf1 --- /dev/null +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/IncompatibleClassTracker.kt @@ -0,0 +1,17 @@ +/* + * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.codegen.state + +import org.jetbrains.kotlin.load.kotlin.KotlinJvmBinaryClass + +interface IncompatibleClassTracker { + fun record(binaryClass: KotlinJvmBinaryClass) + + object DoNothing : IncompatibleClassTracker { + override fun record(binaryClass: KotlinJvmBinaryClass) { + } + } +} \ No newline at end of file diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.kt index f4bfaedc02e..14d52b3627e 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.kt @@ -87,6 +87,9 @@ class KotlinTypeMapper @JvmOverloads constructor( private val moduleName: String, val languageVersionSettings: LanguageVersionSettings, private val useOldInlineClassesManglingScheme: Boolean, + // temporary returned to preserve binary compatibility with Dagger in IDE + // https://android.googlesource.com/platform/tools/adt/idea/+/refs/heads/mirror-goog-studio-master-dev/dagger/src/com/android/tools/idea/dagger/DaggerAnnotatedElementsSearch.kt + private val incompatibleClassTracker: IncompatibleClassTracker = IncompatibleClassTracker.DoNothing, val jvmTarget: JvmTarget = JvmTarget.DEFAULT, private val isIrBackend: Boolean = false, private val typePreprocessor: ((KotlinType) -> KotlinType?)? = null, diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/KotlinIndicesHelper.kt b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/KotlinIndicesHelper.kt index ccbe0f7724a..1f230dd9fac 100644 --- a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/KotlinIndicesHelper.kt +++ b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/KotlinIndicesHelper.kt @@ -136,6 +136,15 @@ class KotlinIndicesHelper( processIndex(KotlinTopLevelPropertyFqnNameIndex.getInstance()) } + // Temporary returned to preserve binary compatibility with AS 203 (ComposeModifierCompletionContributor uses this method) + fun getCallableTopLevelExtensions( + callTypeAndReceiver: CallTypeAndReceiver<*, *>, + position: KtExpression, + bindingContext: BindingContext, + nameFilter: (String) -> Boolean + ): Collection = + getCallableTopLevelExtensions(callTypeAndReceiver, position, bindingContext, null, nameFilter) + fun getCallableTopLevelExtensions( callTypeAndReceiver: CallTypeAndReceiver<*, *>, position: KtExpression,