Support Void.TYPE as underlying Class object for KClass
#KT-20875 Fixed
This commit is contained in:
@@ -29,6 +29,7 @@ import org.jetbrains.kotlin.load.java.descriptors.JavaPropertyDescriptor
|
||||
import org.jetbrains.kotlin.load.java.sources.JavaSourceElement
|
||||
import org.jetbrains.kotlin.load.kotlin.JvmPackagePartSource
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.NameUtils
|
||||
import org.jetbrains.kotlin.platform.JavaToKotlinClassMap
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
@@ -156,6 +157,8 @@ private val Method.signature: String
|
||||
returnType.desc
|
||||
|
||||
internal object RuntimeTypeMapper {
|
||||
private val JAVA_LANG_VOID = ClassId.topLevel(FqName("java.lang.Void"))
|
||||
|
||||
fun mapSignature(possiblySubstitutedFunction: FunctionDescriptor): JvmFunctionSignature {
|
||||
// Fake overrides don't have a source element, so we need to take a declaration.
|
||||
// TODO: support the case when a fake override overrides several declarations with different signatures
|
||||
@@ -263,6 +266,8 @@ internal object RuntimeTypeMapper {
|
||||
return ClassId.topLevel(KotlinBuiltIns.FQ_NAMES.array.toSafe())
|
||||
}
|
||||
|
||||
if (klass == Void.TYPE) return JAVA_LANG_VOID
|
||||
|
||||
klass.primitiveType?.let {
|
||||
return ClassId(KotlinBuiltIns.BUILT_INS_PACKAGE_FQ_NAME, it.typeName)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user