Exclude exceptions from java.lang package for which type aliases exist in kotlin package.
Add relevant note to the type aliases.
This commit is contained in:
@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.resolve.jvm.platform
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.builtins.DefaultBuiltIns
|
import org.jetbrains.kotlin.builtins.DefaultBuiltIns
|
||||||
import org.jetbrains.kotlin.descriptors.ModuleParameters
|
import org.jetbrains.kotlin.descriptors.ModuleParameters
|
||||||
|
import org.jetbrains.kotlin.name.FqName
|
||||||
import org.jetbrains.kotlin.platform.JavaToKotlinClassMap
|
import org.jetbrains.kotlin.platform.JavaToKotlinClassMap
|
||||||
import org.jetbrains.kotlin.platform.PlatformToKotlinClassMap
|
import org.jetbrains.kotlin.platform.PlatformToKotlinClassMap
|
||||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||||
@@ -34,6 +35,8 @@ object JvmPlatform : TargetPlatform("JVM") {
|
|||||||
get() = JavaToKotlinClassMap.INSTANCE
|
get() = JavaToKotlinClassMap.INSTANCE
|
||||||
override val defaultImports: List<ImportPath>
|
override val defaultImports: List<ImportPath>
|
||||||
get() = DEFAULT_IMPORTS_FOR_JVM
|
get() = DEFAULT_IMPORTS_FOR_JVM
|
||||||
|
override val excludedImports: List<FqName>
|
||||||
|
get() = EXCLUDED_IMPORTS_FOR_JVM
|
||||||
}
|
}
|
||||||
|
|
||||||
override val platformConfigurator: PlatformConfigurator = JvmPlatformConfigurator
|
override val platformConfigurator: PlatformConfigurator = JvmPlatformConfigurator
|
||||||
@@ -62,3 +65,17 @@ private val DEFAULT_IMPORTS_FOR_JVM: List<ImportPath> = ArrayList<ImportPath>().
|
|||||||
addAllClassifiersFromScope(builtinPackageFragment.getMemberScope())
|
addAllClassifiersFromScope(builtinPackageFragment.getMemberScope())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val EXCLUDED_IMPORTS_FOR_JVM: List<FqName> = listOf(
|
||||||
|
"Error",
|
||||||
|
"Exception",
|
||||||
|
"RuntimeException",
|
||||||
|
"IllegalArgumentException",
|
||||||
|
"IllegalStateException",
|
||||||
|
"IndexOutOfBoundsException",
|
||||||
|
"UnsupportedOperationException",
|
||||||
|
"NumberFormatException",
|
||||||
|
"NullPointerException",
|
||||||
|
"ClassCastException",
|
||||||
|
"AssertionError"
|
||||||
|
).map { FqName("java.lang.$it") }
|
||||||
@@ -30,5 +30,7 @@ public typealias NullPointerException = java.lang.NullPointerException
|
|||||||
public typealias ClassCastException = java.lang.ClassCastException
|
public typealias ClassCastException = java.lang.ClassCastException
|
||||||
public typealias AssertionError = java.lang.AssertionError
|
public typealias AssertionError = java.lang.AssertionError
|
||||||
|
|
||||||
// kotlin or kotlin.collections?
|
|
||||||
public typealias NoSuchElementException = java.util.NoSuchElementException
|
public typealias NoSuchElementException = java.util.NoSuchElementException
|
||||||
|
|
||||||
|
// NOTE: If you're adding type aliases to types from java.lang, do not forget to exclude aliased types from
|
||||||
|
// imported by default java.lang package. See JvmPlatform.defaultModuleParameters.excludedImports property.
|
||||||
|
|||||||
Reference in New Issue
Block a user