K2: add JVM checker for NO_REFLECTION_IN_CLASS_PATH warning
It's based on the existing K1 checker `JvmReflectionAPICallChecker`. #KT-60587 Fixed
This commit is contained in:
committed by
Space Team
parent
bd46bb02c1
commit
7fc3e60854
@@ -102,6 +102,10 @@ public final class FqName {
|
||||
return fqName.startsWith(segment);
|
||||
}
|
||||
|
||||
public boolean startsWith(@NotNull FqName other) {
|
||||
return fqName.startsWith(other.fqName);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static FqName topLevel(@NotNull Name shortName) {
|
||||
return new FqName(FqNameUnsafe.topLevel(shortName));
|
||||
|
||||
@@ -167,6 +167,17 @@ public final class FqNameUnsafe {
|
||||
return fqName.regionMatches(0, segmentAsString, 0, firstDot == -1 ? Math.max(fqName.length(), segmentAsString.length()) : firstDot);
|
||||
}
|
||||
|
||||
public boolean startsWith(@NotNull FqNameUnsafe other) {
|
||||
if (isRoot()) return false;
|
||||
|
||||
int thisLength = fqName.length();
|
||||
int otherLength = other.fqName.length();
|
||||
if (thisLength < otherLength) return false;
|
||||
|
||||
return (thisLength == otherLength || fqName.charAt(otherLength) == '.') &&
|
||||
fqName.regionMatches(0, other.fqName, 0, otherLength);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static FqNameUnsafe topLevel(@NotNull Name shortName) {
|
||||
return new FqNameUnsafe(shortName.asString(), FqName.ROOT.toUnsafe(), shortName);
|
||||
|
||||
Reference in New Issue
Block a user