/** * Returns all of the superclasses and superinterfaces for a given type including the type itself. * The returned set maintains an internal breadth-first ordering of the type, followed by its * interfaces (and their super-interfaces), then the supertype and its interfaces, and so on. */ protected static Set<JClassType> getFlattenedSuperTypeHierarchy(JClassType type) { Set<JClassType> flattened = type.flattenedSupertypes; if (flattened == null) { flattened = new LinkedHashSet<JClassType>(); getFlattenedSuperTypeHierarchyRecursive(type, flattened); // flattened.size() > 1 for all types other than Object type.flattenedSupertypes = Collections.unmodifiableSet(flattened); } return flattened; }