Replace the trove4j collections usages with the fastutil ones

The trove4j library is licensed under LGPL, and that causes some troubles while working with it. The fastutil library provides the same functionality in the context of our needs, and is licensed under the Apache license.
^KTI-1135 In Progress
This commit is contained in:
Alexander.Likhachev
2023-12-06 12:48:36 +01:00
committed by Space Team
parent dd5fffebf2
commit 21b438f55d
27 changed files with 71 additions and 86 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ dependencies {
api(project(":kotlin-script-runtime"))
api(commonDependency("io.javaslang","javaslang"))
compileOnly(intellijCore())
compileOnly(commonDependency("org.jetbrains.intellij.deps:trove4j"))
compileOnly(commonDependency("org.jetbrains.intellij.deps.fastutil:intellij-deps-fastutil"))
compileOnly(libs.guava)
}
@@ -16,7 +16,7 @@
package org.jetbrains.kotlin.resolve.lazy
import gnu.trove.THashSet
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.descriptors.annotations.Annotations
import org.jetbrains.kotlin.incremental.components.LookupLocation
@@ -257,7 +257,7 @@ class FileScopeFactory(
parentScope: ImportingScope
): ImportingScope {
val scope = packageView.memberScope
val names by lazy(LazyThreadSafetyMode.PUBLICATION) { scope.computeAllNames()?.let(::THashSet) }
val names by lazy(LazyThreadSafetyMode.PUBLICATION) { scope.computeAllNames()?.let(::ObjectOpenHashSet) }
val packageName = packageView.fqName
val excludedNames = aliasImportNames.mapNotNull { if (it.parent() == packageName) it.shortName() else null }
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.resolve.lazy
import com.google.common.collect.HashMultimap
import com.google.common.collect.ImmutableListMultimap
import com.google.common.collect.ListMultimap
import gnu.trove.THashSet
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet
import org.jetbrains.kotlin.builtins.PlatformToKotlinClassMapper
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.config.LanguageVersionSettings
@@ -130,7 +130,7 @@ open class LazyImportResolver<I : KtImportInfo>(
}
val allNames: Set<Name>? by components.storageManager.createNullableLazyValue {
indexedImports.imports.asIterable().flatMapToNullable(THashSet()) { getImportScope(it).computeImportedNames() }
indexedImports.imports.asIterable().flatMapToNullable(ObjectOpenHashSet()) { getImportScope(it).computeImportedNames() }
}
fun definitelyDoesNotContainName(name: Name): Boolean {
@@ -16,7 +16,7 @@
package org.jetbrains.kotlin.types.expressions
import gnu.trove.THashSet
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet
import org.jetbrains.kotlin.config.LanguageVersionSettings
import org.jetbrains.kotlin.descriptors.impl.LocalVariableDescriptor
import org.jetbrains.kotlin.psi.KtLoopExpression
@@ -37,7 +37,7 @@ class PreliminaryLoopVisitor private constructor() : AssignedVariablesSearcher()
languageVersionSettings: LanguageVersionSettings
): DataFlowInfo {
var resultFlowInfo = dataFlowInfo
val nonTrivialValues = THashSet<DataFlowValue>().apply {
val nonTrivialValues = ObjectOpenHashSet<DataFlowValue>().apply {
addAll(dataFlowInfo.completeNullabilityInfo.iterator().map { it._1 })
addAll(dataFlowInfo.completeTypeInfo.iterator().map { it._1 })
}