Fix binary compatibility with Android plugin (KT-30978)

This commit is contained in:
Yan Zhulanow
2019-04-12 20:26:55 +03:00
parent 0dfe122a40
commit 5825da8433
4 changed files with 31 additions and 1 deletions
@@ -171,7 +171,7 @@ class KotlinIndicesHelper(
val additionalDescriptors = ArrayList<CallableDescriptor>(0)
val lookupLocation = this.file?.let { KotlinLookupLocation(it) } ?: NoLookupLocation.FROM_IDE
for (extension in KotlinIndicesHelperExtension.getInstances(project)) {
for (extension in @Suppress("DEPRECATION") KotlinIndicesHelperExtension.getInstances(project)) {
extension.appendExtensionCallables(additionalDescriptors, moduleDescriptor, receiverTypes, nameFilter, lookupLocation)
}
@@ -27,11 +27,22 @@ interface KotlinIndicesHelperExtension {
"org.jetbrains.kotlin.kotlinIndicesHelperExtension", KotlinIndicesHelperExtension::class.java
)
@JvmDefault
fun appendExtensionCallables(
consumer: MutableList<in CallableDescriptor>,
moduleDescriptor: ModuleDescriptor,
receiverTypes: Collection<KotlinType>,
nameFilter: (String) -> Boolean,
lookupLocation: LookupLocation
) {
appendExtensionCallables(consumer, moduleDescriptor, receiverTypes, nameFilter)
}
@Deprecated("Use the appendExtensionCallables() with the 'file' parameter instead.")
fun appendExtensionCallables(
consumer: MutableList<in CallableDescriptor>,
moduleDescriptor: ModuleDescriptor,
receiverTypes: Collection<KotlinType>,
nameFilter: (String) -> Boolean
)
}
@@ -13,6 +13,7 @@ import org.jetbrains.kotlin.incremental.components.LookupTracker
import org.jetbrains.kotlin.storage.LockBasedStorageManager
import org.jetbrains.kotlin.synthetic.JavaSyntheticPropertiesScope
import org.jetbrains.kotlin.types.KotlinType
import java.lang.IllegalStateException
class DebuggerFieldKotlinIndicesHelperExtension : KotlinIndicesHelperExtension {
override fun appendExtensionCallables(
@@ -31,4 +32,13 @@ class DebuggerFieldKotlinIndicesHelperExtension : KotlinIndicesHelperExtension {
}
}
}
override fun appendExtensionCallables(
consumer: MutableList<in CallableDescriptor>,
moduleDescriptor: ModuleDescriptor,
receiverTypes: Collection<KotlinType>,
nameFilter: (String) -> Boolean
) {
throw IllegalStateException("Should not be called")
}
}
@@ -56,4 +56,13 @@ class AndroidIndicesHelperExtension : KotlinIndicesHelperExtension {
}
}
}
override fun appendExtensionCallables(
consumer: MutableList<in CallableDescriptor>,
moduleDescriptor: ModuleDescriptor,
receiverTypes: Collection<KotlinType>,
nameFilter: (String) -> Boolean
) {
throw IllegalStateException("Should not be called")
}
}