Add JavaToKotlinClassMap#isJavaPlatformClass
Use it instead of mapPlatformClass where we only need to check emptiness because mapPlatformClass requires built-ins and it's not always easy to come up with the correct instance of built-ins. In KotlinEvaluationBuilder, use the nullable function findClassAcrossModuleDependencies instead of mapPlatformClass which uses the throwing resolveClassByFqName. This is necessary because DefaultBuiltIns, which are used there, are not always able to find classes mapped by a _Java_ to Kotlin class map. (The correct solution would be not to use DefaultBuiltIns at all, instead obtaining the correct instance of built-ins, which are almost certainly going to be JvmBuiltIns, from the project configuration.)
This commit is contained in:
@@ -93,4 +93,4 @@ class ImportableFqNameClassifier(private val file: KtFile) {
|
||||
}
|
||||
|
||||
fun isJavaClassNotToBeUsedInKotlin(fqName: FqName): Boolean
|
||||
= JavaToKotlinClassMap.INSTANCE.mapPlatformClass(fqName, DefaultBuiltIns.Instance).isNotEmpty() || JavaAnnotationMapper.javaToKotlinNameMap[fqName] != null
|
||||
= JavaToKotlinClassMap.INSTANCE.isJavaPlatformClass(fqName) || JavaAnnotationMapper.javaToKotlinNameMap[fqName] != null
|
||||
|
||||
Reference in New Issue
Block a user