diff --git a/jps-plugin/test/org/jetbrains/kotlin/jps/build/AbstractLookupTrackerTest.kt b/jps-plugin/test/org/jetbrains/kotlin/jps/build/AbstractLookupTrackerTest.kt index 4af96a722b6..628421fca5a 100644 --- a/jps-plugin/test/org/jetbrains/kotlin/jps/build/AbstractLookupTrackerTest.kt +++ b/jps-plugin/test/org/jetbrains/kotlin/jps/build/AbstractLookupTrackerTest.kt @@ -23,7 +23,6 @@ import org.jetbrains.kotlin.test.JetTestUtils import org.jetbrains.kotlin.utils.join import java.io.File import java.util.* -import kotlin.test.fail private val DECLARATION_KEYWORDS = listOf("interface", "class", "enum class", "object", "fun", "val", "var") @@ -34,7 +33,7 @@ abstract class AbstractLookupTrackerTest : AbstractIncrementalJpsTest( // ignore KDoc like comments which starts with `/**`, example: /** text */ val COMMENT_WITH_LOOKUP_INFO = "/\\*[^*]+\\*/".toRegex() - override fun createLookupTracker() = TestLookupTracker() + override fun createLookupTracker(): LookupTracker = TestLookupTracker() override fun checkLookups(lookupTracker: LookupTracker) { if (lookupTracker !is TestLookupTracker) throw AssertionError("Expected TestLookupTracker, but: ${lookupTracker.javaClass}") @@ -50,7 +49,7 @@ abstract class AbstractLookupTrackerTest : AbstractIncrementalJpsTest( val text = file.readText() - val matchResult = COMMENT_WITH_LOOKUP_INFO.match(text) + val matchResult = COMMENT_WITH_LOOKUP_INFO.find(text) if (matchResult != null) { fail("File $file unexpectedly contains multiline comments. In range ${matchResult.range} found: ${matchResult.value} in $text") } @@ -61,7 +60,7 @@ abstract class AbstractLookupTrackerTest : AbstractIncrementalJpsTest( val columnToLookups = lookupsFromLine.groupBy { it.lookupColumn!! }.toList().sortedBy { it.first } val lineContent = lines[line - 1] - val parts = ArrayList(columnToLookups.size() * 2) + val parts = ArrayList(columnToLookups.size * 2) var start = 0 @@ -81,7 +80,7 @@ abstract class AbstractLookupTrackerTest : AbstractIncrementalJpsTest( else -> "(" + it.name + ")" } - it.scopeKind.toString()[0].toLowerCase().toString() + ":" + it.scopeFqName + name + it.scopeKind.toString()[0].toLowerCase().toString() + ":" + it.scopeFqName.let { if (it.isNotEmpty()) it else "" } + name } parts.add(lookups) @@ -89,7 +88,7 @@ abstract class AbstractLookupTrackerTest : AbstractIncrementalJpsTest( start = end } - lines[line - 1] = parts.join("") + lineContent.subSequence(start, lineContent.length()) + lines[line - 1] = parts.join("") + lineContent.subSequence(start, lineContent.length) } val actual = lines.joinToString("\n")