Cache negative hits in InheritanceMap

This commit is contained in:
Agaricus 2013-02-18 19:07:08 -08:00
parent 3d40eca480
commit 5b02d05ed2
2 changed files with 10 additions and 6 deletions

View File

@ -119,6 +119,10 @@ public class InheritanceMap implements IInheritanceProvider {
} }
} }
public boolean hasParents(String className) {
return inheritanceMap.containsKey(className);
}
public List<String> getParents(String className) { public List<String> getParents(String className) {
return inheritanceMap.get(className); return inheritanceMap.get(className);
} }

View File

@ -69,14 +69,14 @@ public class JarMapping {
String mapped = map.get(key); String mapped = map.get(key);
if (mapped == null) { if (mapped == null) {
List<String> parents = inheritanceMap.getParents(owner); List<String> parents = null;
if (parents == null && fallbackInheritanceProvider != null) {
if (inheritanceMap.hasParents(owner)) {
parents = inheritanceMap.getParents(owner);
} else if (fallbackInheritanceProvider != null) {
parents = fallbackInheritanceProvider.getParents(owner); parents = fallbackInheritanceProvider.getParents(owner);
if (parents != null) {
// cache
inheritanceMap.setParents(owner, (ArrayList<String>) parents); inheritanceMap.setParents(owner, (ArrayList<String>) parents);
} }
}
if (parents != null) { if (parents != null) {
// climb the inheritance tree // climb the inheritance tree