private void collectAllSupertypes(ArrayList<InterfaceType> supertypes) {
ArrayList<InterfaceType> typesToVisit = new ArrayList<InterfaceType>();
ArrayList<ClassElement> visitedClasses = new ArrayList<ClassElement>();
typesToVisit.add(this.getType());
while (!typesToVisit.isEmpty()) {
InterfaceType currentType = typesToVisit.remove(0);
ClassElement currentElement = currentType.getElement();
if (!visitedClasses.contains(currentElement)) {
visitedClasses.add(currentElement);
if (currentType != this.getType()) {
supertypes.add(currentType);
}
InterfaceType supertype = currentType.getSuperclass();
if (supertype != null) {
typesToVisit.add(supertype);
}
for (InterfaceType type : currentElement.getInterfaces()) {
typesToVisit.add(type);