From 5579449cdc2dddba5d452ed4b27e5ba0b2183e46 Mon Sep 17 00:00:00 2001 From: Pavel Punegov <32519625+PavelPunegov@users.noreply.github.com> Date: Fri, 28 Jun 2019 16:52:12 +0300 Subject: [PATCH] Fix incorrect package replacement: should check that current occurrence is not a part of identifier --- .../main/groovy/org/jetbrains/kotlin/KonanTest.groovy | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/build-tools/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy b/build-tools/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy index 9cb998940f8..2a8ae0d5f4d 100644 --- a/build-tools/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy +++ b/build-tools/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy @@ -444,11 +444,10 @@ class RunExternalTestGroup extends OldKonanTest { if (line.contains("$pkg.") && ! (line =~ packagePattern || line =~ importRegex) && ! vars.contains(pkg)) { def idx = 0 - while ((idx = line.indexOf(pkg, idx)) >= 0) { - if (!Character.isJavaIdentifierPart(line.charAt(idx - 1))) { - line = line.substring(0, idx) + "$sourceName.$pkg" + line.substring(idx + pkg.length()) - idx += sourceName.length() + pkg.length() + 1 - } + while ((idx = line.indexOf(pkg, idx)) >= 0 && + !Character.isJavaIdentifierPart(line.charAt(idx - 1))) { + line = line.substring(0, idx) + "$sourceName.$pkg" + line.substring(idx + pkg.length()) + idx += sourceName.length() + pkg.length() + 1 } } }