code: public static Set<Class> gatherAllBridgeTypes(Set<Class> set, Class leaf) {
          set.add(leaf);
          for (Class c : leaf.getInterfaces()) {
              gatherAllBridgeTypes(set, c);
          }
          if ((leaf = leaf.getSuperclass()) != null) {
              gatherAllBridgeTypes(set, leaf);
          }
          return set;
      }
docs: Collect a set of all the interfaces and recursively all superclasses for the leaf
  (genericised class) and root (genericised base class).  Eg, for Object<foo>, all
  classes and implemented interfaces for every superclass between foo (the leaf) and
  Object (the base).
  <P>A copy must be coercible into any of these types, and copy bridge methods must be
  provided to do so.
  
  <P>Note that the official documentation for this is in draft form, and you have to be
  psychic to have figured out the necessity in the first place.
  
  @param set set into which the class types will be collected
  @param leaf leaf class
  @return same set as was passed in