[J2KT] Maps core Java types into Kotlin.
@@ -77,13 +77,39 @@ private val TypeVariable.typeDescriptorSourceString
get() = if (isWildcardOrCapture) "*" else name
private val TypeDeclaration.sourceString
+ get() = mappedSourceStringOrNull ?: declaredSourceString
+
+private val TypeDeclaration.mappedSourceStringOrNull
get() =
when (qualifiedSourceName) {
+ "java.lang.Annotation" -> "Annotation"
+ "java.lang.Boolean" -> "Boolean"
+ "java.lang.Byte" -> "Byte"
+ "java.lang.Char" -> "Char"
+ "java.lang.CharSequence" -> "CharSequence"
+ "java.lang.Cloneable" -> "Cloneable"
+ "java.lang.Comparable" -> "Comparable"
+ "java.lang.Double" -> "Double"
+ "java.lang.Enum" -> "Enum"
+ "java.lang.Error" -> "Error"
+ "java.lang.Exception" -> "Exception"
+ "java.lang.Float" -> "Float"
+ "java.lang.Integer" -> "Int"
+ "java.lang.Iterable" -> "Iterable"
+ "java.lang.Iterator" -> "Iterator"
+ "java.lang.Long" -> "Long"
+ "java.lang.Number" -> "Number"
"java.lang.Object" -> "Any"
+ "java.lang.Short" -> "Short"
"java.lang.String" -> "String"
- else -> "$packagePrefixSourceString$classComponentsSourceString"
+ "java.lang.Throwable" -> "Throwable"
+ // TODO(b/202058120): Handle remaining types.
+ else -> null
}
+private val TypeDeclaration.declaredSourceString
+ get() = "$packagePrefixSourceString$classComponentsSourceString"
+
private val TypeDeclaration.packagePrefixSourceString
get() = packageName?.let { "$it." } ?: ""
