Extract some methods in codegen

Introduce DescriptorUtils#getInnerClasses(), which gets all descriptors from
inner classes scope and asserts that they are classes.

Inner/outer classes attributes are generated in separate methods.
This commit is contained in:
Alexander Udalov
2012-09-19 19:03:23 +04:00
parent 37fd9cea08
commit 5af90c2a83
2 changed files with 41 additions and 23 deletions
@@ -355,4 +355,14 @@ public class DescriptorUtils {
+ (classifier == null ? "null" : classifier.getClass());
return (ClassDescriptor) classifier;
}
@SuppressWarnings("unchecked")
public static Collection<ClassDescriptor> getInnerClasses(ClassDescriptor classDescriptor) {
Collection<DeclarationDescriptor> innerClasses = classDescriptor.getUnsubstitutedInnerClassesScope().getAllDescriptors();
for (DeclarationDescriptor inner : innerClasses) {
assert inner instanceof ClassDescriptor
: "Not a class in inner classes scope of " + classDescriptor + ": " + inner;
}
return (Collection) innerClasses;
}
}