Revert "[light classes] drop old light classes and backend: iteration #8"

This reverts commit 0df6ac688a.
This commit is contained in:
Dmitry Gridin
2022-06-28 13:52:08 +02:00
parent 38c623bc3a
commit 91fa6af556
4 changed files with 3 additions and 8 deletions
@@ -46,7 +46,7 @@ class CliLightClassGenerationSupport(
private class CliLightClassSupport(
private val project: Project,
override val languageVersionSettings: LanguageVersionSettings,
override val jvmTarget: JvmTarget
private val jvmTarget: JvmTarget
) : KtUltraLightSupport {
// This is the way to untie CliLightClassSupport and CliLightClassGenerationSupport to prevent descriptors leak
@@ -6,9 +6,6 @@
package org.jetbrains.kotlin.asJava.classes
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper
import org.jetbrains.kotlin.config.JvmAnalysisFlags
import org.jetbrains.kotlin.config.JvmDefaultMode
import org.jetbrains.kotlin.config.JvmTarget
import org.jetbrains.kotlin.config.LanguageVersionSettings
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
import org.jetbrains.kotlin.name.Name
@@ -21,8 +18,6 @@ interface KtUltraLightSupport {
val typeMapper: KotlinTypeMapper
val moduleDescriptor: ModuleDescriptor
val languageVersionSettings: LanguageVersionSettings
val jvmTarget: JvmTarget
val jvmDefaultMode: JvmDefaultMode get() = languageVersionSettings.getFlag(JvmAnalysisFlags.jvmDefaultMode)
fun possiblyHasAlias(file: KtFile, shortName: Name): Boolean
}
@@ -330,7 +330,7 @@ private fun KtUltraLightClass.lightMethod(
descriptor,
OwnerKind.IMPLEMENTATION,
support.deprecationResolver,
support.jvmDefaultMode,
support.typeMapper.jvmDefaultMode,
)
packMethodFlags(asmFlags, JvmCodegenUtil.isJvmInterface(kotlinOrigin.resolve() as? ClassDescriptor))
}
@@ -87,7 +87,7 @@ internal fun PsiAnnotation.tryConvertAsTarget(support: KtUltraLightSupport): KtL
attributeValues ?: return null
val targetMapping = targetMappings.getValue(support.jvmTarget)
val targetMapping = targetMappings.getValue(support.typeMapper.jvmTarget)
val convertedValues = attributeValues.mapNotNull { targetMapping[it] }.distinct()
val targetAttributes = "value" to ArrayValue(convertedValues) { module -> module.builtIns.array.defaultType }