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 {
compileOnly(intellijCore())
compileOnly(libs.guava)
compileOnly(commonDependency("org.jetbrains.intellij.deps:trove4j"))
compileOnly(commonDependency("org.jetbrains.intellij.deps.fastutil:intellij-deps-fastutil"))
jflexPath(commonDependency("org.jetbrains.intellij.deps.jflex", "jflex"))
}
@@ -18,7 +18,7 @@ package org.jetbrains.kotlin.psi
import com.intellij.openapi.util.TextRange
import com.intellij.psi.LiteralTextEscaper
import gnu.trove.TIntArrayList
import it.unimi.dsi.fastutil.ints.IntArrayList
import org.jetbrains.kotlin.psi.psiUtil.getContentRange
import org.jetbrains.kotlin.psi.psiUtil.isSingleQuoted
import kotlin.math.min
@@ -27,7 +27,7 @@ class KotlinStringLiteralTextEscaper(host: KtStringTemplateExpression) : Literal
private var sourceOffsets: IntArray? = null
override fun decode(rangeInsideHost: TextRange, outChars: StringBuilder): Boolean {
val sourceOffsetsList = TIntArrayList()
val sourceOffsetsList = IntArrayList()
var sourceOffset = 0
for (child in myHost.entries) {
@@ -44,7 +44,7 @@ class KotlinStringLiteralTextEscaper(host: KtStringTemplateExpression) : Literal
//don't allow injection if its range starts or ends inside escaped sequence
//but still process offsets for the already decoded part
sourceOffsetsList.add(sourceOffset)
sourceOffsets = sourceOffsetsList.toNativeArray()
sourceOffsets = sourceOffsetsList.toIntArray()
return false
}
val unescaped = child.unescapedValue
@@ -64,7 +64,7 @@ class KotlinStringLiteralTextEscaper(host: KtStringTemplateExpression) : Literal
}
}
sourceOffsetsList.add(sourceOffset)
sourceOffsets = sourceOffsetsList.toNativeArray()
sourceOffsets = sourceOffsetsList.toIntArray()
return true
}