Move dangerous ClassId.fromString() to test

This commit is contained in:
Pavel V. Talanov
2015-04-06 19:17:30 +03:00
parent 336886f115
commit 09947d8f58
2 changed files with 18 additions and 21 deletions
@@ -113,15 +113,4 @@ public final class ClassId {
if (packageFqName.isRoot()) return "/" + relativeClassName;
return packageFqName.toString().replace('.', '/') + "/" + relativeClassName;
}
@NotNull
public static ClassId fromString(@NotNull String string) {
int lastSlash = string.lastIndexOf("/");
if (lastSlash == -1) {
throw new IllegalArgumentException("Class id should contain slash: " + string);
}
FqName relativeClassName = new FqName(string.substring(lastSlash + 1));
FqName packageFqName = new FqName(string.substring(0, lastSlash).replace('/', '.'));
return new ClassId(packageFqName, relativeClassName, false);
}
}