Finding class by class id instead of fq name in rename tests.

This commit is contained in:
Evgeny Gerashchenko
2015-03-13 18:32:56 +03:00
parent c875584d0c
commit 3a8ded5b58
41 changed files with 56 additions and 47 deletions
@@ -108,4 +108,15 @@ 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);
}
FqNameUnsafe relativeClassName = new FqNameUnsafe(string.substring(lastSlash + 1));
FqName packageFqName = new FqName(string.substring(0, lastSlash).replace('/', '.'));
return new ClassId(packageFqName, relativeClassName, false);
}
}