Pass JvmTarget to KotlinTypeMapper
Also use KotlinTypeMapper.RELEASE_COROUTINES_DEFAULT instead of false in FileRankingCalculator
This commit is contained in:
+2
-1
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.codegen.signature
|
||||
import org.jetbrains.kotlin.codegen.ClassBuilderMode
|
||||
import org.jetbrains.kotlin.codegen.state.IncompatibleClassTracker
|
||||
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper
|
||||
import org.jetbrains.kotlin.config.JvmTarget
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.load.java.JvmAbi
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
@@ -17,7 +18,7 @@ class KotlinToJvmSignatureMapperImpl : KotlinToJvmSignatureMapper {
|
||||
// We use empty BindingContext, because it is only used by KotlinTypeMapper for purposes irrelevant to the needs of this class
|
||||
private val typeMapper = KotlinTypeMapper(
|
||||
BindingContext.EMPTY, ClassBuilderMode.LIGHT_CLASSES,
|
||||
IncompatibleClassTracker.DoNothing, JvmAbi.DEFAULT_MODULE_NAME, false, KotlinTypeMapper.RELEASE_COROUTINES_DEFAULT,
|
||||
IncompatibleClassTracker.DoNothing, JvmAbi.DEFAULT_MODULE_NAME, JvmTarget.DEFAULT, KotlinTypeMapper.RELEASE_COROUTINES_DEFAULT,
|
||||
false
|
||||
)
|
||||
|
||||
|
||||
+3
-2
@@ -10,6 +10,7 @@ import com.intellij.util.containers.MultiMap
|
||||
import org.jetbrains.kotlin.codegen.ClassBuilderFactory
|
||||
import org.jetbrains.kotlin.codegen.ClassBuilderMode
|
||||
import org.jetbrains.kotlin.codegen.SignatureCollectingClassBuilderFactory
|
||||
import org.jetbrains.kotlin.config.JvmTarget
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor.Kind.DELEGATION
|
||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor.Kind.FAKE_OVERRIDE
|
||||
@@ -54,8 +55,8 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
|
||||
|
||||
// Avoid errors when some classes are not loaded for some reason
|
||||
private val typeMapper = KotlinTypeMapper(
|
||||
bindingContext, ClassBuilderMode.LIGHT_CLASSES, IncompatibleClassTracker.DoNothing, moduleName, false, isReleaseCoroutines,
|
||||
isIrBackend
|
||||
bindingContext, ClassBuilderMode.LIGHT_CLASSES, IncompatibleClassTracker.DoNothing, moduleName, JvmTarget.DEFAULT,
|
||||
isReleaseCoroutines, isIrBackend
|
||||
)
|
||||
private val reportDiagnosticsTasks = ArrayList<() -> Unit>()
|
||||
|
||||
|
||||
@@ -172,7 +172,6 @@ class GenerationState private constructor(
|
||||
val languageVersionSettings = configuration.languageVersionSettings
|
||||
|
||||
val target = configuration.get(JVMConfigurationKeys.JVM_TARGET) ?: JvmTarget.DEFAULT
|
||||
val isJvm8Target: Boolean = target == JvmTarget.JVM_1_8
|
||||
|
||||
val moduleName: String = moduleName ?: JvmCodegenUtil.getModuleName(module)
|
||||
val classBuilderMode: ClassBuilderMode = builderFactory.classBuilderMode
|
||||
@@ -187,7 +186,7 @@ class GenerationState private constructor(
|
||||
classBuilderMode,
|
||||
IncompatibleClassTrackerImpl(extraJvmDiagnosticsTrace),
|
||||
this.moduleName,
|
||||
isJvm8Target,
|
||||
target,
|
||||
configuration.languageVersionSettings.supportsFeature(LanguageFeature.ReleaseCoroutines),
|
||||
isIrBackend
|
||||
)
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.jetbrains.kotlin.codegen.inline.FictitiousArrayConstructor;
|
||||
import org.jetbrains.kotlin.codegen.signature.AsmTypeFactory;
|
||||
import org.jetbrains.kotlin.codegen.signature.BothSignatureWriter;
|
||||
import org.jetbrains.kotlin.codegen.signature.JvmSignatureWriter;
|
||||
import org.jetbrains.kotlin.config.JvmTarget;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.descriptors.impl.LocalVariableAccessorDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.impl.LocalVariableDescriptor;
|
||||
@@ -85,9 +86,9 @@ public class KotlinTypeMapper {
|
||||
private final ClassBuilderMode classBuilderMode;
|
||||
private final IncompatibleClassTracker incompatibleClassTracker;
|
||||
private final String moduleName;
|
||||
private final boolean isJvm8Target;
|
||||
private final JvmTarget jvmTarget;
|
||||
private final boolean isReleaseCoroutines;
|
||||
private boolean isIrBackend;
|
||||
private final boolean isIrBackend;
|
||||
|
||||
private final TypeMappingConfiguration<Type> typeMappingConfiguration = new TypeMappingConfiguration<Type>() {
|
||||
@NotNull
|
||||
@@ -157,17 +158,7 @@ public class KotlinTypeMapper {
|
||||
@NotNull ClassBuilderMode classBuilderMode,
|
||||
@NotNull IncompatibleClassTracker incompatibleClassTracker,
|
||||
@NotNull String moduleName,
|
||||
boolean isJvm8Target
|
||||
) {
|
||||
this(bindingContext, classBuilderMode, incompatibleClassTracker, moduleName, isJvm8Target, false, false);
|
||||
}
|
||||
|
||||
public KotlinTypeMapper(
|
||||
@NotNull BindingContext bindingContext,
|
||||
@NotNull ClassBuilderMode classBuilderMode,
|
||||
@NotNull IncompatibleClassTracker incompatibleClassTracker,
|
||||
@NotNull String moduleName,
|
||||
boolean isJvm8Target,
|
||||
@NotNull JvmTarget jvmTarget,
|
||||
boolean isReleaseCoroutines,
|
||||
boolean isIrBackend
|
||||
) {
|
||||
@@ -175,7 +166,7 @@ public class KotlinTypeMapper {
|
||||
this.classBuilderMode = classBuilderMode;
|
||||
this.incompatibleClassTracker = incompatibleClassTracker;
|
||||
this.moduleName = moduleName;
|
||||
this.isJvm8Target = isJvm8Target;
|
||||
this.jvmTarget = jvmTarget;
|
||||
this.isReleaseCoroutines = isReleaseCoroutines;
|
||||
this.isIrBackend = isIrBackend;
|
||||
}
|
||||
@@ -954,7 +945,8 @@ public class KotlinTypeMapper {
|
||||
return new CallableMethod(
|
||||
owner, ownerForDefaultImpl, defaultImplDesc, signature, invokeOpcode,
|
||||
thisClass, dispatchReceiverKotlinType, receiverParameterType, extensionReceiverKotlinType, calleeType, returnKotlinType,
|
||||
isJvm8Target ? isInterfaceMember : invokeOpcode == INVOKEINTERFACE, isDefaultMethodInInterface
|
||||
jvmTarget.compareTo(JvmTarget.JVM_1_8) >= 0 ? isInterfaceMember : invokeOpcode == INVOKEINTERFACE,
|
||||
isDefaultMethodInInterface
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user