* lookup maps.
*/
private ArrayList<MemberMap> gatherInterfaceLookupMaps(ClassElement classElt,
HashSet<ClassElement> visitedInterfaces) {
InterfaceType supertype = classElt.getSupertype();
ClassElement superclassElement = supertype != null ? supertype.getElement() : null;
InterfaceType[] mixins = classElt.getMixins();
InterfaceType[] interfaces = classElt.getInterfaces();
// Recursively collect the list of mappings from all of the interface types
ArrayList<MemberMap> lookupMaps = new ArrayList<MemberMap>(interfaces.length + mixins.length
+ 1);
//
// Superclass element
//
if (superclassElement != null) {
if (!visitedInterfaces.contains(superclassElement)) {
try {
visitedInterfaces.add(superclassElement);
//
// Recursively compute the map for the super type.
//
MemberMap map = computeInterfaceLookupMap(superclassElement, visitedInterfaces);
map = new MemberMap(map);
//
// Substitute the super type down the hierarchy.
//
substituteTypeParametersDownHierarchy(supertype, map);
//
// Add any members from the super type into the map as well.
//
recordMapWithClassMembers(map, supertype, true);
lookupMaps.add(map);
} finally {
visitedInterfaces.remove(superclassElement);
}
} else {
return null;
}
}
//
// Mixin elements
//
for (int i = mixins.length - 1; i >= 0; i--) {
InterfaceType mixinType = mixins[i];
ClassElement mixinElement = mixinType.getElement();
if (mixinElement != null) {
if (!visitedInterfaces.contains(mixinElement)) {
try {
visitedInterfaces.add(mixinElement);
//
// Recursively compute the map for the mixin.
//
MemberMap map = computeInterfaceLookupMap(mixinElement, visitedInterfaces);
map = new MemberMap(map);
//
// Substitute the mixin type down the hierarchy.
//
substituteTypeParametersDownHierarchy(mixinType, map);
//
// Add any members from the mixin type into the map as well.
//
recordMapWithClassMembers(map, mixinType, true);
lookupMaps.add(map);
} finally {
visitedInterfaces.remove(mixinElement);
}
} else {
return null;
}
}
}
//
// Interface elements
//
for (InterfaceType interfaceType : interfaces) {
ClassElement interfaceElement = interfaceType.getElement();
if (interfaceElement != null) {
if (!visitedInterfaces.contains(interfaceElement)) {
try {
visitedInterfaces.add(interfaceElement);