Fix null superclass in inheritance map

Object has no superclass, so don't add it to the list.
Also allow InheritanceMap setParents null as a shorthand for none.
This commit is contained in:
Agaricus 2013-04-26 18:44:06 -07:00
parent d33223562d
commit 29104f24d2
3 changed files with 11 additions and 3 deletions

View File

@ -128,7 +128,11 @@ public class InheritanceMap implements InheritanceProvider {
}
public void setParents(String className, Collection<String> parents) {
inheritanceMap.put(className, new ArrayList<String>(parents));
if (parents == null) {
inheritanceMap.put(className, new ArrayList<String>());
} else {
inheritanceMap.put(className, new ArrayList<String>(parents));
}
}
public int size() {

View File

@ -65,7 +65,9 @@ public class ClassLoaderProvider implements InheritanceProvider {
for (String iface : (List<String>) node.interfaces) {
parents.add(iface);
}
parents.add(node.superName);
if (node.superName != null) {
parents.add(node.superName);
}
return parents;
} catch (IOException ex) {

View File

@ -58,7 +58,9 @@ public class JarProvider implements InheritanceProvider {
for (String iface : (List<String>) node.interfaces) {
parents.add(iface);
}
parents.add(node.superName);
if (node.superName != null) {
parents.add(node.superName);
}
return parents;
}