If a part of the identifier was found skip it, adding the length of the searched package.

This commit is contained in:
Pavel Punegov
2019-07-01 14:04:57 +03:00
committed by Pavel Punegov
parent 5579449cdc
commit bab661ddcd
@@ -444,10 +444,13 @@ 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 &&
!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) {
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
} else {
idx += pkg.length()
}
}
}
}