From b70d71a1f7467b595de9bf296a29fefdf29eba47 Mon Sep 17 00:00:00 2001 From: Stanislav Ruban Date: Thu, 31 Jul 2025 14:43:30 +0300 Subject: [PATCH] [migration to Kotlin LV 2.3] Update Kotlin code w.r.t. KTLC-284 (2) (non-trivial migrations w/ increased null safety) GitOrigin-RevId: 187042c28c6d6326013b3d48249f8b7d1e106f2f --- .../fus/fileTypes/FileTypeUsageCounterCollector.kt | 7 +++---- .../idea/debugger/base/util/KotlinAllFilesScopeProvider.kt | 7 +++---- .../intellij/maven/testFramework/MavenImportingTestCase.kt | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/fus/fileTypes/FileTypeUsageCounterCollector.kt b/platform/platform-impl/src/com/intellij/internal/statistic/collectors/fus/fileTypes/FileTypeUsageCounterCollector.kt index 26258204f072..85dc881d384d 100644 --- a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/fus/fileTypes/FileTypeUsageCounterCollector.kt +++ b/platform/platform-impl/src/com/intellij/internal/statistic/collectors/fus/fileTypes/FileTypeUsageCounterCollector.kt @@ -62,10 +62,9 @@ object FileTypeUsageCounterCollector : CounterUsagesCollector() { private val FILE_TEMPLATE_FIELD: EventField = StringValidatedByCustomRule(FILE_TEMPLATE_NAME, BundledFileTemplateValidationRule::class.java) - private fun registerFileTypeEvent(eventId: String, vararg extraFields: EventField<*>?): VarargEventId { - val baseFields = arrayOf?>(EventFields.PluginInfoFromInstance, EventFields.FileType, EventFields.AnonymizedPath, - SCHEMA, FILE_EXTENSION) - return GROUP.registerVarargEvent(eventId, *ArrayUtil.mergeArrays?>(baseFields, extraFields)) + private fun registerFileTypeEvent(eventId: String, vararg extraFields: EventField<*>): VarargEventId { + val baseFields = arrayOf(EventFields.PluginInfoFromInstance, EventFields.FileType, EventFields.AnonymizedPath, SCHEMA, FILE_EXTENSION) + return GROUP.registerVarargEvent(eventId, *ArrayUtil.mergeArrays(baseFields, extraFields)) } private val SELECT: VarargEventId = registerFileTypeEvent("select") diff --git a/plugins/kotlin/jvm-debugger/base/util/src/org/jetbrains/kotlin/idea/debugger/base/util/KotlinAllFilesScopeProvider.kt b/plugins/kotlin/jvm-debugger/base/util/src/org/jetbrains/kotlin/idea/debugger/base/util/KotlinAllFilesScopeProvider.kt index 64a9c7786e8e..61a9ad7eb4c3 100644 --- a/plugins/kotlin/jvm-debugger/base/util/src/org/jetbrains/kotlin/idea/debugger/base/util/KotlinAllFilesScopeProvider.kt +++ b/plugins/kotlin/jvm-debugger/base/util/src/org/jetbrains/kotlin/idea/debugger/base/util/KotlinAllFilesScopeProvider.kt @@ -21,10 +21,9 @@ class KotlinAllFilesScopeProvider(private val project: Project) { KotlinSourceFilterScope.projectAndLibrarySources(GlobalSearchScope.allScope(project), project) ) { private val projectIndex = ProjectRootManager.getInstance(this@KotlinAllFilesScopeProvider.project).fileIndex - private val scopeComparator = Comparator - .comparing { projectIndex.isInSourceContent(it) } - .thenComparing { projectIndex.isInLibrarySource(it) } - .thenComparing { file1, file2 -> super.compare(file1, file2) } + private val scopeComparator = compareBy { projectIndex.isInSourceContent(it) } + .thenComparing { file: VirtualFile -> projectIndex.isInLibrarySource(file) } + .thenComparing { file1: VirtualFile, file2: VirtualFile -> super.compare(file1, file2) } override fun compare(file1: VirtualFile, file2: VirtualFile): Int = scopeComparator.compare(file1, file2) } diff --git a/plugins/maven/testFramework/src/com/intellij/maven/testFramework/MavenImportingTestCase.kt b/plugins/maven/testFramework/src/com/intellij/maven/testFramework/MavenImportingTestCase.kt index fc36476bea3f..eb46880613e1 100644 --- a/plugins/maven/testFramework/src/com/intellij/maven/testFramework/MavenImportingTestCase.kt +++ b/plugins/maven/testFramework/src/com/intellij/maven/testFramework/MavenImportingTestCase.kt @@ -308,7 +308,7 @@ abstract class MavenImportingTestCase : MavenTestCase() { protected fun getModule(name: String): Module { val m = ReadAction.compute { ModuleManager.getInstance(project).findModuleByName(name) } assertNotNull("Module $name not found", m) - return m + return m as Module } protected fun assertMavenizedModule(name: String) {