Rename CompanionObjectMapping.hasMappingToObject -> isMappedIntrinsicCompanionObject
This commit is contained in:
@@ -33,7 +33,7 @@ public class FieldInfo {
|
||||
throw new UnsupportedOperationException("Can't create singleton field for class: " + classDescriptor);
|
||||
}
|
||||
|
||||
if (isNonCompanionObject(classDescriptor) || CompanionObjectMapping.INSTANCE.hasMappingToObject(classDescriptor)) {
|
||||
if (isNonCompanionObject(classDescriptor) || CompanionObjectMapping.INSTANCE.isMappedIntrinsicCompanionObject(classDescriptor)) {
|
||||
return createSingletonViaInstance(classDescriptor, typeMapper);
|
||||
}
|
||||
|
||||
|
||||
@@ -103,6 +103,6 @@ public final class JvmAbi {
|
||||
public static boolean isCompanionObjectWithBackingFieldsInOuter(@NotNull DeclarationDescriptor companionObject) {
|
||||
return isCompanionObject(companionObject) &&
|
||||
isClassOrEnumClass(companionObject.getContainingDeclaration()) &&
|
||||
!CompanionObjectMapping.INSTANCE.hasMappingToObject((ClassDescriptor) companionObject);
|
||||
!CompanionObjectMapping.INSTANCE.isMappedIntrinsicCompanionObject((ClassDescriptor) companionObject);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ object CompanionObjectMapping {
|
||||
fun allClassesWithIntrinsicCompanions(): Set<FqName> =
|
||||
Collections.unmodifiableSet(classesFqNames)
|
||||
|
||||
fun hasMappingToObject(classDescriptor: ClassDescriptor): Boolean {
|
||||
fun isMappedIntrinsicCompanionObject(classDescriptor: ClassDescriptor): Boolean {
|
||||
if (!DescriptorUtils.isCompanionObject(classDescriptor)) return false
|
||||
val fqName = DescriptorUtils.getFqName(classDescriptor.containingDeclaration)
|
||||
if (!fqName.isSafe) return false
|
||||
|
||||
@@ -128,7 +128,7 @@ internal class KClassImpl<T : Any>(override val jClass: Class<T>) :
|
||||
val descriptor = descriptor
|
||||
if (descriptor.kind != ClassKind.OBJECT) return@lazy null
|
||||
|
||||
val field = if (descriptor.isCompanionObject && !CompanionObjectMapping.hasMappingToObject(descriptor)) {
|
||||
val field = if (descriptor.isCompanionObject && !CompanionObjectMapping.isMappedIntrinsicCompanionObject(descriptor)) {
|
||||
jClass.enclosingClass.getDeclaredField(descriptor.name.asString())
|
||||
}
|
||||
else {
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ class DefaultClassObjectIntrinsic(val fqName: FqName): ObjectIntrinsic {
|
||||
|
||||
class ObjectIntrinsics {
|
||||
fun getIntrinsic(classDescriptor: ClassDescriptor): ObjectIntrinsic {
|
||||
if (!CompanionObjectMapping.hasMappingToObject(classDescriptor)) return NO_OBJECT_INTRINSIC
|
||||
if (!CompanionObjectMapping.isMappedIntrinsicCompanionObject(classDescriptor)) return NO_OBJECT_INTRINSIC
|
||||
|
||||
val containingDeclaration = classDescriptor.containingDeclaration
|
||||
val name = Name.identifier(containingDeclaration.name.asString() + "CompanionObject")
|
||||
|
||||
Reference in New Issue
Block a user