code: public static Set<Class<?>> commonSuperclasses(Iterable<Class<?>> classes) {
          Iterator<Class<?>> it = classes.iterator();
          if (!it.hasNext()) {
              return Collections.emptySet();
          }
          // begin with set from first hierarchy
          Set<Class<?>> result = getSuperclasses(it.next());
          // remove non-superclasses of remaining
          while (it.hasNext()) {
              Class<?> c = it.next();
              Iterator<Class<?>> resultIt = result.iterator();
              while (resultIt.hasNext()) {
                  Class<?> sup = resultIt.next();
                  if (!sup.isAssignableFrom(c)) {
                      resultIt.remove();
                  }
              }
          }
          return result;
      }
docs: Returns common superclasses of all {@code classes}.
  This may include elements of {@code classes} itself.
  @param classes the classes
  @return set of superclasses