Fix FqNameUnsafe.startsWith() when first segment of fqName is shorter than given segment
FqNameUnsafe("c.C").startsWith("cnames")
must return false
It's a refix of fdf826208f
This commit is contained in:
committed by
Space Team
parent
0dd24a4de9
commit
93af9f33e4
@@ -163,8 +163,10 @@ public final class FqNameUnsafe {
|
||||
return false;
|
||||
|
||||
int firstDot = fqName.indexOf('.');
|
||||
int fqNameFirstSegmentLength = firstDot == -1 ? fqName.length() : firstDot;
|
||||
String segmentAsString = segment.asString();
|
||||
return fqName.regionMatches(0, segmentAsString, 0, firstDot == -1 ? Math.max(fqName.length(), segmentAsString.length()) : firstDot);
|
||||
return fqNameFirstSegmentLength == segmentAsString.length() &&
|
||||
fqName.regionMatches(0, segmentAsString, 0, fqNameFirstSegmentLength);
|
||||
}
|
||||
|
||||
public boolean startsWith(@NotNull FqNameUnsafe other) {
|
||||
|
||||
Reference in New Issue
Block a user