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