private List<String> solveReferences(List<String> errors, List<ClassDescriptor> rootClassDescriptors) {
Set<ClassDescriptor> toRemove = new HashSet<ClassDescriptor>();
for( ClassDescriptor cd : (Collection<ClassDescriptor>)this.descriptors.getClassDescriptorsByClassName().values() ) {
if (null != cd.getExtend() && !"".equals(cd.getExtend())) {
ClassDescriptor superClassDescriptor = this.descriptors.getClassDescriptorByName(cd.getExtend());
if (superClassDescriptor == null) {
log.warn("Dropping class {}: Base class {} not registered", cd.getClassName(), cd.getExtend());
toRemove.add(cd);
// errors.add("Cannot find mapping for class "
// + cd.getExtend() + " referenced as extends from "
// + cd.getClassName());
} else {
log.debug("Class {} extends {}", cd.getClassName(), cd.getExtend());
cd.setSuperClassDescriptor(superClassDescriptor);
}
} else {
log.debug("Class {} is a root class", cd.getClassName());
rootClassDescriptors.add(cd);
}
@SuppressWarnings("unchecked")
Collection<String> interfaces = cd.getImplements();
for (String interfaceName : interfaces) {
ClassDescriptor interfaceClassDescriptor = this.descriptors.getClassDescriptorByName(interfaceName);
if (interfaceClassDescriptor == null) {
log.warn("Dropping class {}: Interface class {} not registered", cd.getClassName(), interfaceName);
toRemove.add(cd);
// errors.add("Cannot find mapping for interface "
// + interfaceName + " referenced as implements from "
// + cd.getClassName());
} else {
log.debug("Class " + cd.getClassName() + " implements "
+ interfaceName);
//cd.setSuperClassDescriptor(interfaceClassDescriptor);
interfaceClassDescriptor.addDescendantClassDescriptor(cd);
}
}
}