Map intrinsic companion objects in JavaToKotlinClassMap

Get rid of multiple usages of IntrinsicObjects where JavaToKotlinClassMap was
already used, simplify code, and support loading of *CompanionObject as Kotlin
built-in companions from Java code.

Also fix a small bug where Boolean was considered a class with an intrinsic
companion in IntrinsicObjects, although it was not
This commit is contained in:
Alexander Udalov
2015-04-23 19:33:37 +03:00
parent 987206bf95
commit d2cd7b00bb
12 changed files with 62 additions and 111 deletions
@@ -35,9 +35,9 @@ class DefaultClassObjectIntrinsic(val fqName: FqName, val moduleName: String): O
}
}
public class ObjectIntrinsics : CompanionObjectMapping() {
public class ObjectIntrinsics {
public fun getIntrinsic(classDescriptor: ClassDescriptor): ObjectIntrinsic {
if (!hasMappingToObject(classDescriptor)) return NO_OBJECT_INTRINSIC
if (!CompanionObjectMapping.hasMappingToObject(classDescriptor)) return NO_OBJECT_INTRINSIC
val containingDeclaration = classDescriptor.getContainingDeclaration()
val name = Name.identifier(containingDeclaration.getName().asString() + "CompanionObject")