Replace deprecated usages of max/min with maxOrNull/minOrNull

This commit is contained in:
Alexander Udalov
2020-08-13 18:14:02 +02:00
parent 81dda96ece
commit a9ddf02556
48 changed files with 86 additions and 84 deletions
@@ -197,7 +197,7 @@ object SourceNavigationHelper {
): T? {
val classFqName = entity.fqName ?: return null
return targetScopes(entity, navigationKind).firstNotNullResult { scope ->
index.get(classFqName.asString(), entity.project, scope).minBy { it.isExpectDeclaration() }
index.get(classFqName.asString(), entity.project, scope).minByOrNull { it.isExpectDeclaration() }
}
}
@@ -47,7 +47,7 @@ fun getLibraryLanguageLevel(
): LanguageVersion {
val minVersion = getRuntimeLibraryVersions(module, rootModel, platformKind.orDefault())
.addReleaseVersionIfNecessary(coerceRuntimeLibraryVersionToReleased)
.minWith(VersionComparatorUtil.COMPARATOR)
.minWithOrNull(VersionComparatorUtil.COMPARATOR)
return getDefaultLanguageLevel(module, minVersion, coerceRuntimeLibraryVersionToReleased)
}
@@ -60,7 +60,7 @@ fun getDefaultLanguageLevel(
?: KotlinVersionInfoProvider.EP_NAME.extensions
.mapNotNull { it.getCompilerVersion(module) }
.addReleaseVersionIfNecessary(coerceRuntimeLibraryVersionToReleased)
.minWith(VersionComparatorUtil.COMPARATOR)
.minWithOrNull(VersionComparatorUtil.COMPARATOR)
?: return VersionView.RELEASED_VERSION
return libVersion.toLanguageVersion()
}
@@ -94,7 +94,7 @@ open class KotlinPsiChecker : AbstractKotlinPsiChecker() {
}
private fun createQuickFixes(similarDiagnostics: Collection<Diagnostic>): MultiMap<Diagnostic, IntentionAction> {
val first = similarDiagnostics.minBy { it.toString() }
val first = similarDiagnostics.minByOrNull { it.toString() }
val factory = similarDiagnostics.first().getRealDiagnosticFactory()
val actions = MultiMap<Diagnostic, IntentionAction>()