Fix some nullable usages of not-null type parameters (KT-36770)
This commit is contained in:
@@ -27,7 +27,7 @@ class InlineCache {
|
|||||||
val methodNodeById: SLRUMap<MethodId, SMAPAndMethodNode> = SLRUMap(60, 50)
|
val methodNodeById: SLRUMap<MethodId, SMAPAndMethodNode> = SLRUMap(60, 50)
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun <K, V> SLRUMap<K, V>.getOrPut(key: K, defaultValue: () -> V): V {
|
inline fun <K, V : Any> SLRUMap<K, V>.getOrPut(key: K, defaultValue: () -> V): V {
|
||||||
val value = get(key)
|
val value = get(key)
|
||||||
return if (value == null) {
|
return if (value == null) {
|
||||||
val answer = defaultValue()
|
val answer = defaultValue()
|
||||||
|
|||||||
@@ -80,5 +80,5 @@ fun KotlinType.getSubtypesPredicate(): TypePredicate = when {
|
|||||||
|
|
||||||
private fun KotlinType.render(): String = DescriptorRenderer.SHORT_NAMES_IN_TYPES.renderType(this)
|
private fun KotlinType.render(): String = DescriptorRenderer.SHORT_NAMES_IN_TYPES.renderType(this)
|
||||||
|
|
||||||
fun <T> TypePredicate.expectedTypeFor(keys: Iterable<T>): Map<T, TypePredicate> =
|
fun <T : Any> TypePredicate.expectedTypeFor(keys: Iterable<T>): Map<T, TypePredicate> =
|
||||||
keys.fold(SmartFMap.emptyMap<T, TypePredicate>()) { map, key -> map.plus(key, this) }
|
keys.fold(SmartFMap.emptyMap<T, TypePredicate>()) { map, key -> map.plus(key, this) }
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ import com.intellij.openapi.extensions.ExtensionPoint
|
|||||||
import com.intellij.openapi.extensions.ExtensionPointName
|
import com.intellij.openapi.extensions.ExtensionPointName
|
||||||
import com.intellij.openapi.extensions.Extensions
|
import com.intellij.openapi.extensions.Extensions
|
||||||
|
|
||||||
open class ApplicationExtensionDescriptor<T>(name: String, private val extensionClass: Class<T>) {
|
open class ApplicationExtensionDescriptor<T : Any>(name: String, private val extensionClass: Class<T>) {
|
||||||
val extensionPointName: ExtensionPointName<T> = ExtensionPointName.create(name)
|
val extensionPointName: ExtensionPointName<T> = ExtensionPointName.create(name)
|
||||||
|
|
||||||
fun registerExtensionPoint() {
|
fun registerExtensionPoint() {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import com.intellij.openapi.extensions.ExtensionPointName
|
|||||||
import com.intellij.openapi.extensions.Extensions
|
import com.intellij.openapi.extensions.Extensions
|
||||||
import com.intellij.openapi.project.Project
|
import com.intellij.openapi.project.Project
|
||||||
|
|
||||||
open class ProjectExtensionDescriptor<T>(name: String, private val extensionClass: Class<T>) {
|
open class ProjectExtensionDescriptor<T : Any>(name: String, private val extensionClass: Class<T>) {
|
||||||
val extensionPointName: ExtensionPointName<T> = ExtensionPointName.create(name)
|
val extensionPointName: ExtensionPointName<T> = ExtensionPointName.create(name)
|
||||||
|
|
||||||
fun registerExtensionPoint(project: Project) {
|
fun registerExtensionPoint(project: Project) {
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ object CallDiagnosticToDiagnostic {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private inline fun <reified E : PsiElement, A, C : KotlinCallDiagnostic> put(
|
private inline fun <reified E : PsiElement, A : Any, C : KotlinCallDiagnostic> put(
|
||||||
factory1: DiagnosticFactory1<E, A>,
|
factory1: DiagnosticFactory1<E, A>,
|
||||||
klass: Class<C>,
|
klass: Class<C>,
|
||||||
crossinline getA: C.() -> A
|
crossinline getA: C.() -> A
|
||||||
@@ -57,7 +57,7 @@ object CallDiagnosticToDiagnostic {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private inline fun <reified E : PsiElement, A, B, C : KotlinCallDiagnostic> put(
|
private inline fun <reified E : PsiElement, A : Any, B : Any, C : KotlinCallDiagnostic> put(
|
||||||
factory2: DiagnosticFactory2<E, A, B>, klass: Class<C>, crossinline getA: C.() -> A, crossinline getB: C.() -> B
|
factory2: DiagnosticFactory2<E, A, B>, klass: Class<C>, crossinline getA: C.() -> A, crossinline getB: C.() -> B
|
||||||
) {
|
) {
|
||||||
checkPut<E, C>(klass) {
|
checkPut<E, C>(klass) {
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ import org.jetbrains.kotlin.scripting.extensions.ScriptingResolveExtension
|
|||||||
import org.jetbrains.kotlin.scripting.resolve.ScriptReportSink
|
import org.jetbrains.kotlin.scripting.resolve.ScriptReportSink
|
||||||
import java.net.URLClassLoader
|
import java.net.URLClassLoader
|
||||||
|
|
||||||
private fun <T> ProjectExtensionDescriptor<T>.registerExtensionIfRequired(project: MockProject, extension: T) {
|
private fun <T : Any> ProjectExtensionDescriptor<T>.registerExtensionIfRequired(project: MockProject, extension: T) {
|
||||||
try {
|
try {
|
||||||
registerExtension(project, extension)
|
registerExtension(project, extension)
|
||||||
} catch (ex: IllegalArgumentException) {
|
} catch (ex: IllegalArgumentException) {
|
||||||
|
|||||||
Reference in New Issue
Block a user