New J2K: correctly convert Kotlin function type

This commit is contained in:
Ilya Kirillov
2019-06-10 09:53:11 +03:00
parent a2b832e5be
commit b211ae1070
@@ -136,8 +136,10 @@ class TypeMappingConversion(val context: NewJ2kConverterContext) : RecursiveAppl
else toKotlinTypesMap[fqName]
}
private fun JKClassSymbol.kotlinStandardType(): String? =
JavaToKotlinClassMap.mapJavaToKotlin(FqName(fqName))?.asString()
private fun JKClassSymbol.kotlinStandardType(): String? {
if (isKtFunction(fqName)) return fqName
return JavaToKotlinClassMap.mapJavaToKotlin(FqName(fqName))?.asString()
}
private fun JKJavaPrimitiveType.mapPrimitiveType(): JKClassType {
val fqName = jvmPrimitiveType.primitiveType.typeFqName
@@ -156,4 +158,10 @@ class TypeMappingConversion(val context: NewJ2kConverterContext) : RecursiveAppl
else -> false
}
}
companion object {
private val ktFunctionRegex = "kotlin\\.jvm\\.functions\\.Function\\d+".toRegex()
private fun isKtFunction(fqName: String) =
ktFunctionRegex.matches(fqName)
}
}