DescriptorFinder now can find class names in a package

This helps to get rid of "repeated class_name" field in Package protobuf
message. DescriptorFinder in resolve.java uses PSI to find all classes in a
package, and the finder for built-ins just reads .kotlin_class_names file
This commit is contained in:
Alexander Udalov
2013-07-15 22:54:55 +04:00
parent 047ed18901
commit b602db03f2
12 changed files with 114 additions and 191 deletions
@@ -55,9 +55,6 @@ public class KotlinPackageAnnotationTest extends CodegenTestCase {
PackageData data = JavaProtoBufUtil.readPackageDataFrom(kotlinPackage.data());
Set<String> classNames = collectClassNames(data);
assertSameElements(Arrays.asList("A", "B", "C"), classNames);
Set<String> callableNames = collectCallableNames(data);
assertSameElements(Arrays.asList("foo", "bar", "C"), callableNames);
}
@@ -71,13 +68,4 @@ public class KotlinPackageAnnotationTest extends CodegenTestCase {
}
return callableNames;
}
@NotNull
private static Set<String> collectClassNames(@NotNull PackageData data) {
Set<String> classNames = new HashSet<String>();
for (int name : data.getPackageProto().getClassNameList()) {
classNames.add(data.getNameResolver().getName(name).asString());
}
return classNames;
}
}