Fix "Should be replaced with Kotlin function" warnings

This commit is contained in:
Dmitry Gridin
2019-04-16 12:12:06 +07:00
parent d738a12b86
commit 3bed360c98
77 changed files with 161 additions and 99 deletions
@@ -21,6 +21,7 @@ import com.intellij.psi.LiteralTextEscaper
import gnu.trove.TIntArrayList
import org.jetbrains.kotlin.psi.psiUtil.getContentRange
import org.jetbrains.kotlin.psi.psiUtil.isSingleQuoted
import kotlin.math.min
class KotlinStringLiteralTextEscaper(host: KtStringTemplateExpression) : LiteralTextEscaper<KtStringTemplateExpression>(host) {
private var sourceOffsets: IntArray? = null
@@ -70,7 +71,7 @@ class KotlinStringLiteralTextEscaper(host: KtStringTemplateExpression) : Literal
override fun getOffsetInHost(offsetInDecoded: Int, rangeInsideHost: TextRange): Int {
val offsets = sourceOffsets
if (offsets == null || offsetInDecoded >= offsets.size) return -1
return Math.min(offsets[offsetInDecoded], rangeInsideHost.length) + rangeInsideHost.startOffset
return min(offsets[offsetInDecoded], rangeInsideHost.length) + rangeInsideHost.startOffset
}
override fun getRelevantTextRange(): TextRange {
@@ -33,7 +33,7 @@ class KtClassBody : KtElementImplStub<KotlinPlaceHolderStub<KtClassBody>>, KtDec
override fun getParent() = parentByStub
override fun getDeclarations() = Arrays.asList(*getStubOrPsiChildren(DECLARATION_TYPES, KtDeclaration.ARRAY_FACTORY))
override fun getDeclarations() = listOf(*getStubOrPsiChildren(DECLARATION_TYPES, KtDeclaration.ARRAY_FACTORY))
override fun <R, D> accept(visitor: KtVisitor<R, D>, data: D) = visitor.visitClassBody(this, data)