Refer to builtin names in HeuristicSignatures and j2k TypeVisitor
This commit is contained in:
@@ -22,6 +22,7 @@ import com.intellij.psi.impl.source.PsiClassReferenceType
|
||||
import org.jetbrains.kotlin.j2k.ast.*
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmPrimitiveType
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns.FQ_NAMES as BUILTIN_NAMES
|
||||
|
||||
private val PRIMITIVE_TYPES_NAMES = JvmPrimitiveType.values().map { it.javaKeywordName }
|
||||
|
||||
@@ -127,28 +128,34 @@ class TypeVisitor(
|
||||
|
||||
companion object {
|
||||
private val toKotlinTypesMap: Map<String, String> = mapOf(
|
||||
CommonClassNames.JAVA_LANG_OBJECT to "kotlin.Any",
|
||||
CommonClassNames.JAVA_LANG_BYTE to "kotlin.Byte",
|
||||
CommonClassNames.JAVA_LANG_CHARACTER to "kotlin.Char",
|
||||
CommonClassNames.JAVA_LANG_DOUBLE to "kotlin.Double",
|
||||
CommonClassNames.JAVA_LANG_FLOAT to "kotlin.Float",
|
||||
CommonClassNames.JAVA_LANG_INTEGER to "kotlin.Int",
|
||||
CommonClassNames.JAVA_LANG_LONG to "kotlin.Long",
|
||||
CommonClassNames.JAVA_LANG_SHORT to "kotlin.Short",
|
||||
CommonClassNames.JAVA_LANG_BOOLEAN to "kotlin.Boolean",
|
||||
CommonClassNames.JAVA_LANG_ITERABLE to "kotlin.Iterable",
|
||||
CommonClassNames.JAVA_UTIL_ITERATOR to "kotlin.Iterator",
|
||||
CommonClassNames.JAVA_UTIL_LIST to "kotlin.List",
|
||||
CommonClassNames.JAVA_UTIL_COLLECTION to "kotlin.Collection",
|
||||
CommonClassNames.JAVA_UTIL_SET to "kotlin.Set",
|
||||
CommonClassNames.JAVA_UTIL_MAP to "kotlin.Map"
|
||||
CommonClassNames.JAVA_LANG_OBJECT to BUILTIN_NAMES.any.asString(),
|
||||
CommonClassNames.JAVA_LANG_BYTE to BUILTIN_NAMES._byte.asString(),
|
||||
CommonClassNames.JAVA_LANG_CHARACTER to BUILTIN_NAMES._char.asString(),
|
||||
CommonClassNames.JAVA_LANG_DOUBLE to BUILTIN_NAMES._double.asString(),
|
||||
CommonClassNames.JAVA_LANG_FLOAT to BUILTIN_NAMES._float.asString(),
|
||||
CommonClassNames.JAVA_LANG_INTEGER to BUILTIN_NAMES._int.asString(),
|
||||
CommonClassNames.JAVA_LANG_LONG to BUILTIN_NAMES._long.asString(),
|
||||
CommonClassNames.JAVA_LANG_SHORT to BUILTIN_NAMES._short.asString(),
|
||||
CommonClassNames.JAVA_LANG_BOOLEAN to BUILTIN_NAMES._boolean.asString(),
|
||||
CommonClassNames.JAVA_LANG_ITERABLE to BUILTIN_NAMES.iterable.asString(),
|
||||
CommonClassNames.JAVA_UTIL_ITERATOR to BUILTIN_NAMES.iterator.asString(),
|
||||
CommonClassNames.JAVA_UTIL_LIST to BUILTIN_NAMES.list.asString(),
|
||||
CommonClassNames.JAVA_UTIL_COLLECTION to BUILTIN_NAMES.collection.asString(),
|
||||
CommonClassNames.JAVA_UTIL_SET to BUILTIN_NAMES.set.asString(),
|
||||
CommonClassNames.JAVA_UTIL_MAP to BUILTIN_NAMES.map.asString(),
|
||||
CommonClassNames.JAVA_UTIL_MAP_ENTRY to BUILTIN_NAMES.mapEntry.asString(),
|
||||
java.util.ListIterator::class.java.canonicalName to BUILTIN_NAMES.listIterator.asString()
|
||||
|
||||
)
|
||||
|
||||
val toKotlinMutableTypesMap: Map<String, String> = mapOf(
|
||||
CommonClassNames.JAVA_UTIL_LIST to "kotlin.MutableList",
|
||||
CommonClassNames.JAVA_UTIL_COLLECTION to "kotlin.MutableCollection",
|
||||
CommonClassNames.JAVA_UTIL_SET to "kotlin.MutableSet",
|
||||
CommonClassNames.JAVA_UTIL_MAP to "kotlin.MutableMap"
|
||||
CommonClassNames.JAVA_UTIL_ITERATOR to BUILTIN_NAMES.mutableIterator.asString(),
|
||||
CommonClassNames.JAVA_UTIL_LIST to BUILTIN_NAMES.mutableList.asString(),
|
||||
CommonClassNames.JAVA_UTIL_COLLECTION to BUILTIN_NAMES.mutableCollection.asString(),
|
||||
CommonClassNames.JAVA_UTIL_SET to BUILTIN_NAMES.mutableSet.asString(),
|
||||
CommonClassNames.JAVA_UTIL_MAP to BUILTIN_NAMES.mutableMap.asString(),
|
||||
CommonClassNames.JAVA_UTIL_MAP_ENTRY to BUILTIN_NAMES.mutableMapEntry.asString(),
|
||||
java.util.ListIterator::class.java.canonicalName to BUILTIN_NAMES.mutableListIterator.asString()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user