Drop TypeMappingConfiguration.innerClassNameFactory, use default implementation
After 57d209f599, non-default behavior is no longer used.
#KT-21453 Fixed
This commit is contained in:
+1
-4
@@ -41,7 +41,6 @@ import org.jetbrains.kotlin.descriptors.impl.LocalVariableDescriptor;
|
||||
import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil;
|
||||
import org.jetbrains.kotlin.load.java.JvmAbi;
|
||||
import org.jetbrains.kotlin.load.java.sam.SamConstructorDescriptor;
|
||||
import org.jetbrains.kotlin.load.kotlin.TypeMappingConfiguration;
|
||||
import org.jetbrains.kotlin.name.ClassId;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
@@ -87,7 +86,6 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
private final BindingContext bindingContext;
|
||||
private final GenerationState.GenerateClassFilter filter;
|
||||
private final JvmRuntimeTypes runtimeTypes;
|
||||
private final TypeMappingConfiguration<Type> typeMappingConfiguration;
|
||||
private final SwitchCodegenProvider switchCodegenProvider;
|
||||
private final LanguageVersionSettings languageVersionSettings;
|
||||
private final ClassBuilderMode classBuilderMode;
|
||||
@@ -97,7 +95,6 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
this.bindingContext = state.getBindingContext();
|
||||
this.filter = state.getGenerateDeclaredClassFilter();
|
||||
this.runtimeTypes = state.getJvmRuntimeTypes();
|
||||
this.typeMappingConfiguration = state.getTypeMapper().getTypeMappingConfiguration();
|
||||
this.switchCodegenProvider = new SwitchCodegenProvider(state);
|
||||
this.languageVersionSettings = state.getLanguageVersionSettings();
|
||||
this.classBuilderMode = state.getClassBuilderMode();
|
||||
@@ -269,7 +266,7 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
return base.isEmpty() ? descriptorName.asString() : base + '/' + descriptorName;
|
||||
}
|
||||
else {
|
||||
return typeMappingConfiguration.getInnerClassNameFactory().invoke(base, descriptorName.asString());
|
||||
return base + "$" + descriptorName.asString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.jetbrains.kotlin.codegen.coroutines.*
|
||||
import org.jetbrains.kotlin.codegen.intrinsics.bytecode
|
||||
import org.jetbrains.kotlin.codegen.intrinsics.classId
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState
|
||||
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.annotations.isInlineOnly
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
@@ -557,7 +558,7 @@ abstract class InlineCodegen<out T: BaseExpressionCodegen>(
|
||||
|
||||
assert(callableDescriptor is DeserializedCallableMemberDescriptor) { "Not a deserialized function or proper: " + callableDescriptor }
|
||||
|
||||
val containingClasses = state.typeMapper.getContainingClassesForDeserializedCallable(callableDescriptor as DeserializedCallableMemberDescriptor)
|
||||
val containingClasses = KotlinTypeMapper.getContainingClassesForDeserializedCallable(callableDescriptor as DeserializedCallableMemberDescriptor)
|
||||
|
||||
val containerId = containingClasses.implClassId
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ import com.intellij.psi.PsiElement;
|
||||
import kotlin.Pair;
|
||||
import kotlin.Unit;
|
||||
import kotlin.collections.CollectionsKt;
|
||||
import kotlin.jvm.functions.Function2;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.builtins.BuiltInsPackageFragment;
|
||||
@@ -104,12 +103,6 @@ public class KotlinTypeMapper {
|
||||
return CommonSupertypes.commonSupertype(types);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Function2<String, String, String> getInnerClassNameFactory() {
|
||||
return TypeMappingConfiguration.DefaultImpls.getInnerClassNameFactory(this);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Type getPredefinedTypeForClass(@NotNull ClassDescriptor classDescriptor) {
|
||||
@@ -147,11 +140,6 @@ public class KotlinTypeMapper {
|
||||
this.isJvm8TargetWithDefaults = isJvm8TargetWithDefaults;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public TypeMappingConfiguration<Type> getTypeMappingConfiguration() {
|
||||
return typeMappingConfiguration;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public BindingContext getBindingContext() {
|
||||
return bindingContext;
|
||||
@@ -190,7 +178,7 @@ public class KotlinTypeMapper {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private String internalNameForPackageMemberOwner(@NotNull CallableMemberDescriptor descriptor, boolean publicFacade) {
|
||||
private static String internalNameForPackageMemberOwner(@NotNull CallableMemberDescriptor descriptor, boolean publicFacade) {
|
||||
boolean isAccessor = descriptor instanceof AccessorForCallableDescriptor;
|
||||
if (isAccessor) {
|
||||
descriptor = ((AccessorForCallableDescriptor) descriptor).getCalleeDescriptor();
|
||||
@@ -269,7 +257,7 @@ public class KotlinTypeMapper {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ContainingClassesInfo getContainingClassesForDeserializedCallable(
|
||||
public static ContainingClassesInfo getContainingClassesForDeserializedCallable(
|
||||
@NotNull DeserializedCallableMemberDescriptor deserializedDescriptor
|
||||
) {
|
||||
DeclarationDescriptor parentDeclaration = deserializedDescriptor.getContainingDeclaration();
|
||||
@@ -288,15 +276,14 @@ public class KotlinTypeMapper {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private ClassId getContainerClassIdForClassDescriptor(@NotNull ClassDescriptor classDescriptor) {
|
||||
private static ClassId getContainerClassIdForClassDescriptor(@NotNull ClassDescriptor classDescriptor) {
|
||||
ClassId classId = DescriptorUtilsKt.getClassId(classDescriptor);
|
||||
assert classId != null : "Deserialized class should have a ClassId: " + classDescriptor;
|
||||
|
||||
if (isInterface(classDescriptor)) {
|
||||
FqName relativeClassName = classId.getRelativeClassName();
|
||||
//TODO test nested trait fun inlining
|
||||
String defaultImplsClassName = typeMappingConfiguration.getInnerClassNameFactory()
|
||||
.invoke(relativeClassName.shortName().asString(), JvmAbi.DEFAULT_IMPLS_CLASS_NAME);
|
||||
String defaultImplsClassName = relativeClassName.shortName().asString() + JvmAbi.DEFAULT_IMPLS_SUFFIX;
|
||||
return new ClassId(classId.getPackageFqName(), Name.identifier(defaultImplsClassName));
|
||||
}
|
||||
|
||||
@@ -304,7 +291,7 @@ public class KotlinTypeMapper {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String getPackageMemberOwnerInternalName(@NotNull DeserializedCallableMemberDescriptor descriptor, boolean publicFacade) {
|
||||
private static String getPackageMemberOwnerInternalName(@NotNull DeserializedCallableMemberDescriptor descriptor, boolean publicFacade) {
|
||||
DeclarationDescriptor containingDeclaration = descriptor.getContainingDeclaration();
|
||||
assert containingDeclaration instanceof PackageFragmentDescriptor : "Not a top-level member: " + descriptor;
|
||||
|
||||
@@ -315,7 +302,7 @@ public class KotlinTypeMapper {
|
||||
|
||||
ClassId ownerClassId = publicFacade ? containingClasses.getFacadeClassId()
|
||||
: containingClasses.getImplClassId();
|
||||
return JvmClassName.byClassId(ownerClassId, typeMappingConfiguration).getInternalName();
|
||||
return JvmClassName.byClassId(ownerClassId).getInternalName();
|
||||
}
|
||||
|
||||
private static final ClassId FAKE_CLASS_ID_FOR_BUILTINS = ClassId.topLevel(new FqName("kotlin.KotlinPackage"));
|
||||
@@ -457,9 +444,7 @@ public class KotlinTypeMapper {
|
||||
|
||||
@NotNull
|
||||
public Type mapDefaultImpls(@NotNull ClassDescriptor descriptor) {
|
||||
String defaultImplsClassName = typeMappingConfiguration.getInnerClassNameFactory().invoke(
|
||||
mapType(descriptor).getInternalName(), JvmAbi.DEFAULT_IMPLS_CLASS_NAME);
|
||||
return Type.getObjectType(defaultImplsClassName);
|
||||
return Type.getObjectType(mapType(descriptor).getInternalName() + JvmAbi.DEFAULT_IMPLS_SUFFIX);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -957,7 +942,7 @@ public class KotlinTypeMapper {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String getPartSimpleNameForMangling(@NotNull CallableMemberDescriptor descriptor) {
|
||||
private static String getPartSimpleNameForMangling(@NotNull CallableMemberDescriptor descriptor) {
|
||||
KtFile containingFile = DescriptorToSourceUtils.getContainingFile(descriptor);
|
||||
if (containingFile != null) {
|
||||
JvmFileClassInfo fileClassInfo = JvmFileClassUtil.getFileClassInfoNoResolve(containingFile);
|
||||
@@ -1058,7 +1043,7 @@ public class KotlinTypeMapper {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public JvmMethodGenericSignature mapSignatureWithCustomParameters(
|
||||
private JvmMethodGenericSignature mapSignatureWithCustomParameters(
|
||||
@NotNull FunctionDescriptor f,
|
||||
@NotNull OwnerKind kind,
|
||||
@NotNull List<ValueParameterDescriptor> valueParameters,
|
||||
|
||||
Reference in New Issue
Block a user