synchronized (this) {
// Build a cache key and check the cache
StringBuffer keyb = (packageName == null) ? new StringBuffer() : new StringBuffer(packageName);
keyb.append(".").append(typeName);
String key = keyb.toString();
IProgramElement cachedValue = typeMap.get(key);
if (cachedValue != null) {
return cachedValue;
}
List<IProgramElement> packageNodes = findMatchingPackages(packageName);
for (IProgramElement pkg : packageNodes) {
// this searches each file for a class
for (IProgramElement fileNode : pkg.getChildren()) {
IProgramElement cNode = findClassInNodes(fileNode.getChildren(), typeName, typeName);
if (cNode != null) {
typeMap.put(key, cNode);
return cNode;
}
}